Skip to content
Snippets Groups Projects
Commit 7b3cbe02 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix convert-constants handling of booleans


It turns out that, in Python, booleans are also integers. So they fall
under the “isinstance(value, int)” case, resulting in all enable*
constants being integers in Haskell, which is not nice, even though
we're not using them directly today.

Patch simply adds a special casing for booleans, before integers.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 1fbb19fa
No related merge requests found
#!/usr/bin/python
#
# Copyright (C) 2011, 2012 Google Inc.
# Copyright (C) 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -87,6 +87,8 @@ def HaskellTypeVal(value):
"""
if isinstance(value, basestring):
return ("String", "\"%s\"" % StringValueRules(value))
elif isinstance(value, bool):
return ("Bool", "%s" % value)
elif isinstance(value, int):
return ("Int", "%d" % value)
elif isinstance(value, long):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment