internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: vyperlang/vyper

Issue:
Add uint256 decimal support for convert
### What's your issue about?

Convert should allow conversion of uint256 -> decimal.

### How can it be fixed?

convert.py:57

#### Cute Animal Picture
^.^


Discussion:
Starting on this.

Resolving patch:
diff --git a/vyper/types/convert.py b/vyper/types/convert.py
--- a/vyper/types/convert.py
+++ b/vyper/types/convert.py
@@ -57,11 +57,20 @@ def to_uint256(expr, args, kwargs, context):
         raise InvalidLiteralException("Invalid input for uint256: %r" % in_node, expr)
 
 
-@signature('int128', 'str_literal')
+@signature(('int128', 'uint256'), 'str_literal')
 def to_decimal(expr, args, kwargs, context):
     input = args[0]
-    return LLLnode.from_list(['mul', input, DECIMAL_DIVISOR], typ=BaseType('decimal', input.typ.unit, input.typ.positional),
-                             pos=getpos(expr))
+    if input.typ.typ == 'uint256':
+        return LLLnode.from_list(
+            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],
+            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)
+        )
+    else:
+        return LLLnode.from_list(
+            ['mul', input, DECIMAL_DIVISOR],
+            typ=BaseType('decimal', input.typ.unit, input.typ.positional),
+            pos=getpos(expr)
+        )
 
 
 @signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')


Test patch:
diff --git a/tests/parser/functions/test_convert.py b/tests/parser/functions/test_convert.py
--- a/tests/parser/functions/test_convert.py
+++ b/tests/parser/functions/test_convert.py
@@ -139,6 +139,27 @@ def bytes_to_bytes32(inp: bytes[32]) -> (bytes32, bytes32):
     assert c.bytes_to_bytes32(bytes_helper('', 32)) == [bytes_helper('', 32)] * 2
 
 
+def test_uint256_decimal(assert_tx_failed, get_contract_with_gas_estimation):
+    code = """
+@public
+def test_variable() -> bool:
+    a: uint256 = 1000
+    return convert(a, 'decimal') == 1000.0
+
+@public
+def test_passed_variable(a: uint256) -> decimal:
+    return convert(a, 'decimal')
+    """
+
+    c = get_contract_with_gas_estimation(code)
+
+    assert c.test_variable() is True
+    assert c.test_passed_variable(256) == 256
+    max_decimal = (2**127 - 1)
+    assert c.test_passed_variable(max_decimal) == Decimal(max_decimal)
+    assert_tx_failed(lambda: c.test_passed_variable(max_decimal + 1))
+
+
 def test_convert_to_uint256_units(get_contract, assert_tx_failed):
     code = """
 units: {
Repository: vyperlang/vyper

Issue:
Disallow int128->int128 conversion.
### What's your issue about?

Disallow`int128` to be converted to `int128`, follows https://github.com/ethereum/vyper/pull/882.

### How can it be fixed?

Fill this in if you know how to fix it.

#### Cute Animal Picture
![](https://peopledotcom.files.wordpress.com/2011/06/panda-660.jpg)



Discussion:
I can pick this up. It should be a pretty minor change.

Resolving patch:
diff --git a/vyper/types/convert.py b/vyper/types/convert.py
--- a/vyper/types/convert.py
+++ b/vyper/types/convert.py
@@ -23,11 +23,11 @@
 )
 
 
-@signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')
+@signature(('uint256', 'bytes32', 'bytes'), 'str_literal')
 def to_int128(expr, args, kwargs, context):
     in_node = args[0]
     typ, len = get_type(in_node)
-    if typ in ('int128', 'uint256', 'bytes32'):
+    if typ in ('uint256', 'bytes32'):
         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):
             raise InvalidLiteralException("Number out of range: {}".format(in_node.value), expr)
         return LLLnode.from_list(


Test patch:
diff --git a/tests/parser/functions/test_convert.py b/tests/parser/functions/test_convert.py
--- a/tests/parser/functions/test_convert.py
+++ b/tests/parser/functions/test_convert.py
@@ -3,38 +3,29 @@
 
 def test_convert_to_num(get_contract_with_gas_estimation, assert_tx_failed):
     code = """
-a: int128
-b: uint256
-c: bytes32
-d: bytes[1]
+a: uint256
+b: bytes32
+c: bytes[1]
 
 @public
-def int128_to_num(inp: int128) -> (int128, int128, int128):
+def uint256_to_num(inp: uint256) -> (int128, int128):
     self.a = inp
     memory: int128  = convert(inp, 'int128')
     storage: int128 = convert(self.a, 'int128')
-    literal: int128 = convert(1, 'int128')
-    return  memory, storage, literal
-
-@public
-def uint256_to_num(inp: uint256) -> (int128, int128):
-    self.b = inp
-    memory: int128  = convert(inp, 'int128')
-    storage: int128 = convert(self.b, 'int128')
     return  memory, storage
 
 @public
 def bytes32_to_num() -> (int128, int128):
-    self.c = 0x0000000000000000000000000000000000000000000000000000000000000001
+    self.b = 0x0000000000000000000000000000000000000000000000000000000000000001
     literal: int128 = convert(0x0000000000000000000000000000000000000000000000000000000000000001, 'int128')
-    storage: int128 = convert(self.c, 'int128')
+    storage: int128 = convert(self.b, 'int128')
     return literal, storage
 
 @public
 def bytes_to_num() -> (int128, int128):
-    self.d = 'a'
+    self.c = 'a'
     literal: int128 = convert('a', 'int128')
-    storage: int128 = convert(self.d, 'int128')
+    storage: int128 = convert(self.c, 'int128')
     return literal, storage
 
 @public
@@ -42,7 +33,6 @@ def zero_bytes(inp: bytes[1]) -> int128:
     return convert(inp, 'int128')
 """
     c = get_contract_with_gas_estimation(code)
-    assert c.int128_to_num(1) == [1, 1, 1]
     assert c.uint256_to_num(1) == [1, 1]
     assert c.bytes32_to_num() == [1, 1]
     assert c.bytes_to_num() == [97, 97]
Repository: vyperlang/vyper

Issue:
Binary Literal: Force same length.
### What's your issue about?

Add an additional exception, that makes sure to allow only assignment of bits of the same length.

```
bytes[1] = 0b000
```

### How can it be fixed?
https://github.com/ethereum/vyper/blob/master/vyper/parser/expr.py#L107 
and in `assign` statement.

#### Cute Animal Picture
^.^



Discussion:

Resolving patch:
diff --git a/vyper/parser/expr.py b/vyper/parser/expr.py
--- a/vyper/parser/expr.py
+++ b/vyper/parser/expr.py
@@ -104,9 +104,8 @@ def number(self):
             str_val = orignum[2:]
             total_bits = len(orignum[2:])
             total_bits = total_bits if total_bits % 8 == 0 else total_bits + 8 - (total_bits % 8)  # ceil8 to get byte length.
-            if total_bits != len(orignum[2:]):  # add necessary zero padding.
-                pad_len = total_bits - len(orignum[2:])
-                str_val = pad_len * '0' + str_val
+            if len(orignum[2:]) != total_bits:  # Support only full formed bit definitions.
+                raise InvalidLiteralException("Bit notation requires a multiple of 8 bits / 1 byte. {} bit(s) are missing.".format(total_bits - len(orignum[2:])), self.expr)
             byte_len = int(total_bits / 8)
             placeholder = self.context.new_placeholder(ByteArrayType(byte_len))
             seq = []


Test patch:
diff --git a/tests/parser/syntax/test_bytes.py b/tests/parser/syntax/test_bytes.py
--- a/tests/parser/syntax/test_bytes.py
+++ b/tests/parser/syntax/test_bytes.py
@@ -2,8 +2,10 @@
 from pytest import raises
 
 from vyper import compiler
-from vyper.exceptions import TypeMismatchException
-
+from vyper.exceptions import (
+    TypeMismatchException,
+    InvalidLiteralException
+)
 
 fail_list = [
     """
@@ -59,15 +61,24 @@ def foo() -> bytes[10]:
 @public
 def foo() -> bytes[10]:
     return "badmintonzz"
-    """
+    """,
+    ("""
+@public
+def test() -> bytes[1]:
+    a: bytes[1] = 0b0000001  # needs mutliple of 8 bits.
+    return a
+    """, InvalidLiteralException)
 ]
 
 
 @pytest.mark.parametrize('bad_code', fail_list)
 def test_bytes_fail(bad_code):
-
-    with raises(TypeMismatchException):
-        compiler.compile(bad_code)
+    if isinstance(bad_code, tuple):
+        with raises(bad_code[1]):
+            compiler.compile(bad_code[0])
+    else:
+        with raises(TypeMismatchException):
+            compiler.compile(bad_code)
 
 
 valid_list = [
diff --git a/tests/parser/types/test_bytes.py b/tests/parser/types/test_bytes.py
--- a/tests/parser/types/test_bytes.py
+++ b/tests/parser/types/test_bytes.py
@@ -198,19 +198,19 @@ def test_binary_literal(get_contract_with_gas_estimation):
 
 @public
 def get(a: bytes[1]) -> bytes[2]:
-    return concat(a, 0b0001)
+    return concat(a, 0b00000001)
 
 @public
 def getsome() -> bytes[1]:
-    return 0b1110
+    return 0b00001110
 
 @public
 def testsome(a: bytes[1]) -> bool:
-    return a == 0b1100001
+    return a == 0b01100001
 
 @public
 def testsome_storage(y: bytes[1]) -> bool:
-    self.r = 0b1100001
+    self.r = 0b01100001
     return self.r == y
     """
Repository: vyperlang/vyper

Issue:
Cannot convert to address
### Version Information

* vyper Version:  0.2.0b4

### What's your issue about?
Vyper disallows converting to an address. This is a problem because sometimes we need to process stuff from bytes to an address.

#### Cute Animal Picture
![blue donkey](http://bellatravelplanning.com/wp-content/uploads/2017/10/DSC_0251.jpg)


Discussion:

Resolving patch:
diff --git a/vyper/types/convert.py b/vyper/types/convert.py
--- a/vyper/types/convert.py
+++ b/vyper/types/convert.py
@@ -103,6 +103,13 @@ def to_bytes32(expr, args, kwargs, context):
         return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('bytes32'), pos=getpos(expr))
 
 
+@signature(('bytes32'), '*')
+def to_address(expr, args, kwargs, context):
+    in_arg = args[0]
+
+    return LLLnode(value=in_arg.value, args=in_arg.args, typ=BaseType('address'), pos=getpos(expr))
+
+
 def convert(expr, context):
 
     if isinstance(expr.args[1], ast.Str):
@@ -128,4 +135,5 @@ def convert(expr, context):
     'uint256': to_uint256,
     'decimal': to_decimal,
     'bytes32': to_bytes32,
+    'address': to_address,
 }


Test patch:
diff --git a/tests/parser/types/test_bytes.py b/tests/parser/types/test_bytes.py
--- a/tests/parser/types/test_bytes.py
+++ b/tests/parser/types/test_bytes.py
@@ -4,6 +4,32 @@
 )
 
 
+def test_address_bytes_converstion(get_contract_with_gas_estimation):
+    # Shared values for test addresses and bytes
+    test_address = "0xF5D4020dCA6a62bB1efFcC9212AAF3c9819E30D7"
+    test_bytes = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF5\xD4\x02\x0d\xCA\x6a\x62\xbB\x1e\xfF\xcC\x92\x12\xAA\xF3\xc9\x81\x9E\x30\xD7"
+
+    # This block tests conversion from address to bytes
+    test_address_to_bytes = """
+@public
+def test_address_to_bytes(x: address) -> bytes32:
+    return convert(x, bytes32)
+    """
+
+    c = get_contract_with_gas_estimation(test_address_to_bytes)
+    assert c.test_address_to_bytes(test_address) == test_bytes
+
+    # This block tests conversion from bytes to address
+    test_bytes_to_address = """
+@public
+def test_bytes_to_address(x: bytes32) -> address:
+    return convert(x, address)
+    """
+
+    c = get_contract_with_gas_estimation(test_bytes_to_address)
+    assert c.test_bytes_to_address(test_bytes) == test_address
+
+
 def test_test_bytes(get_contract_with_gas_estimation, assert_tx_failed):
     test_bytes = """
 @public
Repository: vyperlang/vyper

Issue:
Unit Mismatch error for wei_value operation
### Version Information

* vyper Version: https://vyper.online [Wednesday, November 7, 2018]
and
* vyper Version: 0.1.0b4
* pyethereum Version: x.x.x
* OS: linux
* Python Version (python --version): 3.6.6

### What's your issue about?
Unexpected error while compiling my contract. Check the second to the last line in the snippet below
ERROR: `vyper.exceptions.TypeMismatchException: line 177:8 Unit mismatch: {'wei': 1} {}`
Why do I need to convert amount to wei_value again when it has already been declared in the function argument?
Code:
```
@public
@constant
def func(amounts: wei_value[100]) -> bool:
    total: wei_value = as_wei_value(0, "wei")

    # calculate total
    for amount in amounts:
        total += amount # Error: mismatch units

    return True
```
### How can it be fixed?
Convert amount to wei_value
```
@public
@constant
def func(amounts: wei_value[100]) -> bool:
    total: wei_value = as_wei_value(0, "wei")
    
    for amount in amounts:
        total = as_wei_value(amount, "wei") # No error
    return True
```
#### Cute Animal Picture

> cute animal picture



Discussion:
Ah, great catch. #1054 should probably account for this. What do you think @jacquesww? (Iterators should carry types and units)

Edit: wait, 1054 doesn't make sense. I think there is an earlier PR for Iterators
Starting on this.

Resolving patch:
diff --git a/vyper/parser/stmt.py b/vyper/parser/stmt.py
--- a/vyper/parser/stmt.py
+++ b/vyper/parser/stmt.py
@@ -446,7 +446,7 @@ def parse_for_list(self):
         iter_var_type = self.context.vars.get(self.stmt.iter.id).typ if isinstance(self.stmt.iter, ast.Name) else None
         subtype = iter_list_node.typ.subtype.typ
         varname = self.stmt.target.id
-        value_pos = self.context.new_variable(varname, BaseType(subtype))
+        value_pos = self.context.new_variable(varname, BaseType(subtype, unit=iter_list_node.typ.subtype.unit))
         i_pos = self.context.new_variable('_index_for_' + varname, BaseType(subtype))
         self.context.forvars[varname] = True
         if iter_var_type:  # Is a list that is already allocated to memory.


Test patch:
diff --git a/tests/parser/features/iteration/test_for_in_list.py b/tests/parser/features/iteration/test_for_in_list.py
--- a/tests/parser/features/iteration/test_for_in_list.py
+++ b/tests/parser/features/iteration/test_for_in_list.py
@@ -343,3 +343,22 @@ def a() -> uint256:
     c = get_contract_with_gas_estimation(code)
 
     assert c.a() == 99
+
+
+def test_for_in_list_iter_type(get_contract_with_gas_estimation):
+    code = """
+@public
+@constant
+def func(amounts: wei_value[3]) -> wei_value:
+    total: wei_value = as_wei_value(0, "wei")
+
+    # calculate total
+    for amount in amounts:
+        total += amount
+
+    return total
+    """
+
+    c = get_contract_with_gas_estimation(code)
+
+    assert c.func([100, 200, 300]) == 600
Repository: vyperlang/vyper

Issue:
ERC20 and address assignment error
Can I know the relationship between ERC20 and address type? I am confused about it.

I have a storage:
token: ERC20

initilize with an address:
@public
def setup(token_addr: address):
assert (self.token == ZERO_ADDRESS) and token_addr != ZERO_ADDRESS
self.token = ERC20(token_addr)

contract Factory:
def getExchange(token_addr: address) -> address: constant

assert self.factory.getExchange(self.token) == self

We I can getExchange and got this error: vyper.exceptions.TypeMismatchException: Typecasting from base type address(ERC20) to address unavailable


Discussion:
It looks like `factory.getExchange(address)` is barking at you. It should be `factory.getExchange(ERC20)`

@jacqueswww is this compiler check over-defined here?
@hustnn @fubuloubu `self.factory` doesn't exist. Or should I assume it was declared as `factory: Factory`  ?


Resolving patch:
diff --git a/vyper/parser/parser_utils.py b/vyper/parser/parser_utils.py
--- a/vyper/parser/parser_utils.py
+++ b/vyper/parser/parser_utils.py
@@ -28,6 +28,9 @@
     has_dynamic_data,
     is_base_type,
 )
+from vyper.types.types import (
+    ContractType,
+)
 from vyper.typing import (
     ClassTypes,
 )
@@ -372,6 +375,8 @@ def base_type_conversion(orig, frm, to, pos, in_function_call=False):
         )
     elif is_base_type(frm, to.typ) and are_units_compatible(frm, to):
         return LLLnode(orig.value, orig.args, typ=to, add_gas_estimate=orig.add_gas_estimate)
+    elif isinstance(frm, ContractType) and to == BaseType('address'):
+        return LLLnode(orig.value, orig.args, typ=to, add_gas_estimate=orig.add_gas_estimate)
     elif is_valid_int128_to_decimal:
         return LLLnode.from_list(
             ['mul', orig, DECIMAL_DIVISOR],
diff --git a/vyper/types/types.py b/vyper/types/types.py
--- a/vyper/types/types.py
+++ b/vyper/types/types.py
@@ -409,7 +409,7 @@ def parse_type(item, location, sigs=None, custom_units=None, custom_structs=None
         if not isinstance(item.func, ast.Name):
             raise InvalidTypeException("Malformed unit type:", item)
         base_type = item.func.id
-        if base_type not in ('int128', 'uint256', 'decimal'):
+        if base_type not in ('int128', 'uint256', 'decimal', 'address'):
             raise InvalidTypeException("You must use int128, uint256, decimal, address, contract, \
                 for variable declarations and indexed for logging topics ", item)
         if len(item.args) == 0:


Test patch:
diff --git a/tests/parser/syntax/test_functions_call.py b/tests/parser/syntax/test_functions_call.py
--- a/tests/parser/syntax/test_functions_call.py
+++ b/tests/parser/syntax/test_functions_call.py
@@ -54,6 +54,20 @@ def test_functions_call_fail(bad_code):
 @public
 def foo() -> uint256:
     return convert(2, uint256)
+    """,
+    """
+from vyper.interfaces import ERC20
+
+contract Factory:
+    def getExchange(token_addr: address) -> address: constant
+
+token: ERC20
+factory: Factory
+
+@public
+def setup(token_addr: address):
+    self.token = ERC20(token_addr)
+    assert self.factory.getExchange(self.token) == self
     """
 ]
Repository: vyperlang/vyper

Issue:
Vyper treats strings as having length 32
### Version Information

* vyper Version: 0.1.0b9
* OS: osx

### What's your issue about?

When using `concat` Vyper treats all strings as having length 32. Therefore this
```
@public
def conc(a: string[33], b: string[33]) -> string[64]:
   c: string[64] = concat(a, b)
   return c
  ```
will compile and even run (returning a string of length 66) and the following
```
@public
def conc_fail(a: string[5], b: string[4]) -> string[9]:
    c: string[9] = concat(a, b)
    return c
```
leads to a compiler error "Cannot cast from greater max-length 64 to shorter max-length 9".



Discussion:
That's wild, good find.

Resolving patch:
diff --git a/vyper/functions/functions.py b/vyper/functions/functions.py
--- a/vyper/functions/functions.py
+++ b/vyper/functions/functions.py
@@ -232,7 +232,7 @@ def concat(expr, context):
 
     # Maximum length of the output
     total_maxlen = sum([
-        arg.typ.maxlen if isinstance(arg.typ, ByteArrayType) else 32 for arg in args
+        arg.typ.maxlen if isinstance(arg.typ, ByteArrayLike) else 32 for arg in args
     ])
     # Node representing the position of the output in memory
     placeholder = context.new_placeholder(ReturnType(total_maxlen))


Test patch:
diff --git a/tests/parser/functions/test_concat.py b/tests/parser/functions/test_concat.py
--- a/tests/parser/functions/test_concat.py
+++ b/tests/parser/functions/test_concat.py
@@ -1,3 +1,8 @@
+from vyper.exceptions import (
+    TypeMismatchException,
+)
+
+
 def test_concat(get_contract_with_gas_estimation):
     test_concat = """
 @public
@@ -99,3 +104,29 @@ def hoo(x: bytes32, y: bytes32) -> bytes[64]:
     assert c.hoo(b'\x35' * 32, b'\x00' * 32) == b'\x35' * 32 + b'\x00' * 32
 
     print('Passed second concat tests')
+
+
+def test_small_output(get_contract_with_gas_estimation):
+    code = """
+@public
+def small_output(a: string[5], b: string[4]) -> string[9]:
+    c: string[9] = concat(a, b)
+    return c
+    """
+    c = get_contract_with_gas_estimation(code)
+    assert c.small_output('abcde', 'fghi') == 'abcdefghi'
+    assert c.small_output('', '') == ''
+
+
+def test_large_output(get_contract_with_gas_estimation, assert_compile_failed):
+    code = """
+@public
+def large_output(a: string[33], b: string[33]) -> string[64]:
+    c: string[64] = concat(a, b)
+    return c
+    """
+
+    assert_compile_failed(
+        lambda: get_contract_with_gas_estimation(code),
+        TypeMismatchException
+    )
diff --git a/tests/parser/types/test_string.py b/tests/parser/types/test_string.py
--- a/tests/parser/types/test_string.py
+++ b/tests/parser/types/test_string.py
@@ -22,8 +22,8 @@ def test_string_concat(get_contract_with_gas_estimation):
 @public
 def testb(inp: string[10]) -> string[128]:
     a: string[100] = "return message:"
-    a = concat(a, " ", inp)
-    return a
+    b: string[128] = concat(a, " ", inp)
+    return b
 
 @public
 def testa(inp: string[10]) -> string[160]:
Repository: vyperlang/vyper

Issue:
Bool default parameters not working
### Version Information

* vyper Version (output of `vyper --version`): 0.1.0b10
* OS: linux
* Python Version (output of `python --version`): 3.6.7
* Environment (output of `pip freeze`): (At end of report for readability)

### What's your issue about?

* full output of the error: Default parameter values have to be literals.
* what command you ran: vyper test.vy
* the code that caused the failure:
test.vy is the following:
```
@public
def test(a: bool = True) -> bool:
    return a
```

### How can it be fixed?

Not sure precisely how to fix this, but this did work in 0.1.0b09, indicating some code change caused this.

#### Environment
apturl==0.5.2
asn1crypto==0.24.0
Brlapi==0.6.6
certifi==2018.1.18
chardet==3.0.4
chrome-gnome-shell==0.0.0
command-not-found==0.3
cryptography==2.1.4
cupshelpers==1.0
defer==1.0.6
devedeng==4.14.0
distro-info===0.18ubuntu0.18.04.1
httplib2==0.9.2
idna==2.6
keyring==10.6.0
keyrings.alt==3.0
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.13.5
lazr.uri==1.0.3
louis==3.5.0
macaroonbakery==1.1.3
Mako==1.0.7
MarkupSafe==1.0
netifaces==0.10.4
oauth==1.0.1
olefile==0.45.1
pexpect==4.2.1
Pillow==5.1.0
protobuf==3.0.0
pycairo==1.16.2
pycrypto==2.6.1
pycryptodome==3.8.2
pycups==1.9.73
pygobject==3.26.1
pymacaroons==0.13.0
PyNaCl==1.1.2
pyRFC3339==1.0
python-apt==1.6.4
python-dateutil==2.6.1
python-debian==0.1.32
pytz==2018.3
pyxattr==0.6.0
pyxdg==0.25
PyYAML==3.12
reportlab==3.4.0
requests==2.18.4
requests-unixsocket==0.1.5
SecretStorage==2.3.1
simplejson==3.13.2
six==1.11.0
system-service==0.3
systemd-python==234
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.22
usb-creator==0.3.3
virtualenv==15.1.0
vyper==0.1.0b10
wadllib==1.3.2
xkit==0.0.0
youtube-dl==2018.3.14
zope.interface==4.3.2



Discussion:

Resolving patch:
diff --git a/vyper/signatures/function_signature.py b/vyper/signatures/function_signature.py
--- a/vyper/signatures/function_signature.py
+++ b/vyper/signatures/function_signature.py
@@ -168,7 +168,8 @@ def from_definition(cls,
 
         # Validate default values.
         for default_value in getattr(code.args, 'defaults', []):
-            if not isinstance(default_value, (ast.Num, ast.Str, ast.Bytes, ast.List)):
+            allowed_types = (ast.Num, ast.Str, ast.Bytes, ast.List, ast.NameConstant)
+            if not isinstance(default_value, allowed_types):
                 raise FunctionDeclarationException("Default parameter values have to be literals.")
 
         # Determine the arguments, expects something of the form def foo(arg1:


Test patch: