diff options
author | Araq <rumpf_a@web.de> | 2012-07-10 01:12:03 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-07-10 01:12:03 +0200 |
commit | 95faae2c0a0e5e6be8e7502ecf217bf0f325c7c9 (patch) | |
tree | 6bc9862b8ebecb2ea93fc858d86011d40d86160f | |
parent | a6ee0eb29990af101639d4fcca81c5681f2178ed (diff) | |
download | Nim-95faae2c0a0e5e6be8e7502ecf217bf0f325c7c9.tar.gz |
some more bugfixes for the integer promotion rules
-rwxr-xr-x | compiler/semexprs.nim | 2 | ||||
-rwxr-xr-x | compiler/sigmatch.nim | 9 | ||||
-rwxr-xr-x | lib/pure/encodings.nim | 4 | ||||
-rwxr-xr-x | tests/compile/tnewlibs.nim | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index dfd637209..aea1227d0 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -906,7 +906,7 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = n.sons[i] = semExprWithType(c, n.sons[i], flags) var indexType = if arr.kind == tyArray: arr.sons[0] else: getSysType(tyInt) var arg = IndexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1]) - if arg != nil: + if arg != nil: n.sons[1] = arg result = n result.typ = elemType(arr) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index bb3a24823..d841561ed 100755 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -324,10 +324,11 @@ proc typeRel(mapping: var TIdTable, f, a: PType): TTypeRelation = of tyBool, tyChar: if a.kind == f.kind: result = isEqual elif skipTypes(a, {tyRange}).kind == f.kind: result = isSubtype - of tyRange: - if a.kind == f.kind: - result = typeRel(mapping, base(a), base(f)) - if result < isGeneric: result = isNone + of tyRange: + if a.kind == f.kind: + result = typeRel(mapping, base(f), base(a)) + # bugfix: accept integer conversions here + #if result < isGeneric: result = isNone elif skipTypes(f, {tyRange}).kind == a.kind: result = isIntConv elif isConvertibleToRange(skipTypes(f, {tyRange}), a): diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index 6bc0005e9..afc34ed62 100755 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -368,7 +368,7 @@ when defined(windows): lpWideCharStr = cstring(result), cchWideChar = cint(result.len div 2), lpMultiByteStr = cstring(res), - cbMultiByte = cap) + cbMultiByte = cap.cint) if m == 0: # try again; ask for capacity: cap = WideCharToMultiByte( @@ -386,7 +386,7 @@ when defined(windows): lpWideCharStr = cstring(result), cchWideChar = cint(result.len div 2), lpMultiByteStr = cstring(res), - cbMultiByte = cap) + cbMultiByte = cap.cint) if m == 0: OSError() setLen(res, m) result = res diff --git a/tests/compile/tnewlibs.nim b/tests/compile/tnewlibs.nim index c742caeaa..ab358f557 100755 --- a/tests/compile/tnewlibs.nim +++ b/tests/compile/tnewlibs.nim @@ -10,7 +10,7 @@ import osproc, cairowin32, cairoxlib, gl, glut, glu, glx, glext, wingl, - lua, lualib, lauxlib, mysql, sqlite3, db_mongo, osproc + lua, lualib, lauxlib, mysql, sqlite3, db_mongo, md5 writeln(stdout, "test compilation of binding modules") |