diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-06-10 23:33:05 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-06-11 21:38:01 +0300 |
commit | e2d38a57ecdc3aa7b5cd81a9f2f588eb0dc5586f (patch) | |
tree | 396ef1c332c4ec460cd91ec0358a9ec02f76052c /compiler/sigmatch.nim | |
parent | ce933c90a48ddf0331016edbc684ba6937412e22 (diff) | |
download | Nim-e2d38a57ecdc3aa7b5cd81a9f2f588eb0dc5586f.tar.gz |
better support for unsigned integers.
Diffstat (limited to 'compiler/sigmatch.nim')
-rwxr-xr-x | compiler/sigmatch.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 9881e84a3..168936ed4 100755 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -163,6 +163,9 @@ proc handleRange(f, a: PType, min, max: TTypeKind): TTypeRelation = var k = skipTypes(a, {tyRange}).kind if k == f.kind: result = isSubtype elif f.kind == tyInt and k in {tyInt..tyInt32}: result = isIntConv + elif f.kind == tyUInt and k in {tyUInt..tyUInt32}: result = isIntConv + elif f.kind in {tyUInt..tyUInt64} and k == tyInt and tfLiteral in a.flags: + result = isIntConv elif k >= min and k <= max: result = isConvertible else: result = isNone @@ -306,6 +309,11 @@ proc typeRel(mapping: var TIdTable, f, a: PType): TTypeRelation = of tyInt16: result = handleRange(f, a, tyInt8, tyInt16) of tyInt32: result = handleRange(f, a, tyInt, tyInt32) of tyInt64: result = handleRange(f, a, tyInt, tyInt64) + of tyUInt: result = handleRange(f, a, tyUInt8, tyUInt32) + of tyUInt8: result = handleRange(f, a, tyUInt8, tyUInt8) + of tyUInt16: result = handleRange(f, a, tyUInt8, tyUInt16) + of tyUInt32: result = handleRange(f, a, tyUInt, tyUInt32) + of tyUInt64: result = handleRange(f, a, tyUInt, tyUInt64) of tyFloat: result = handleFloatRange(f, a) of tyFloat32: result = handleFloatRange(f, a) of tyFloat64: result = handleFloatRange(f, a) |