diff --git a/compiler/evals.nim b/compiler/evals.nim index 40f1f8e01e..3ef2f4f3bd 100755 --- a/compiler/evals.nim +++ b/compiler/evals.nim @@ -898,7 +898,7 @@ proc evalTemplate*(n: PNode, sym: PSym): PNode = proc evalTypeTrait*(n: PNode, context: PSym): PNode = ## XXX: This should be pretty much guaranteed to be true - # by the type traits procs' signitures, but until the + # by the type traits procs' signatures, but until the # code is more mature it doesn't hurt to be extra safe internalAssert n.sons.len >= 2 and n.sons[1].sym.typ.kind == tyTypeDesc @@ -906,7 +906,7 @@ proc evalTypeTrait*(n: PNode, context: PSym): PNode = let typ = n.sons[1].sym.typ.skipTypes({tyTypeDesc}) case n.sons[0].sym.name.s of "name": - result = newStrNode(nkStrLit, typ.typeToString) + result = newStrNode(nkStrLit, typ.typeToString(preferExported)) result.typ = newType(tyString, context) result.info = n.info diff --git a/compiler/types.nim b/compiler/types.nim index 8005ba806d..3a9352a0d3 100755 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -17,7 +17,7 @@ proc lastOrd*(t: PType): biggestInt proc lengthOrd*(t: PType): biggestInt type TPreferedDesc* = enum - preferName, preferDesc + preferName, preferDesc, preferExported proc TypeToString*(typ: PType, prefer: TPreferedDesc = preferName): string proc getProcHeader*(sym: PSym): string @@ -404,14 +404,14 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = if t == nil: return if prefer == preferName and t.sym != nil and sfAnon notin t.sym.flags: if t.kind == tyInt and isIntLit(t): - return t.sym.Name.s & "(" & $t.n.intVal & ")" + return t.sym.Name.s & " literal(" & $t.n.intVal & ")" return t.sym.Name.s case t.Kind of tyInt: - if not isIntLit(t): + if not isIntLit(t) or prefer == preferExported: result = typeToStr[t.kind] else: - result = "intLit(" & $t.n.intVal & ")" + result = "int literal(" & $t.n.intVal & ")" of tyGenericBody, tyGenericInst, tyGenericInvokation: result = typeToString(t.sons[0]) & '[' for i in countup(1, sonsLen(t) -1 -ord(t.kind != tyGenericInvokation)): @@ -667,7 +667,13 @@ proc sameTuple(a, b: PType, c: var TSameTypeClosure): bool = if sonsLen(a) == sonsLen(b): result = true for i in countup(0, sonsLen(a) - 1): - result = SameTypeAux(a.sons[i], b.sons[i], c) + var x = a.sons[i] + var y = b.sons[i] + if c.ignoreTupleFields: + x = skipTypes(x, {tyRange}) + y = skipTypes(y, {tyRange}) + + result = SameTypeAux(x, y, c) if not result: return if a.n != nil and b.n != nil and not c.ignoreTupleFields: for i in countup(0, sonsLen(a.n) - 1): @@ -746,7 +752,7 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = # increases bootstrapping time from 2.4s to 3.3s on my laptop! So we cheat # again: Since the recursion check is only to not get caught in an endless # recursion, we use a counter and only if it's value is over some - # threshold we perform the expansive exact cycle check: + # threshold we perform the expensive exact cycle check: if c.recCheck < 3: inc c.recCheck else: diff --git a/examples/gtk/ex6.nim b/examples/gtk/ex6.nim index 4e4c3e8648..7374b19cda 100755 --- a/examples/gtk/ex6.nim +++ b/examples/gtk/ex6.nim @@ -38,7 +38,7 @@ add(window, windowbox) discard signal_connect(window, "destroy", SIGNAL_FUNC(ex6.destroy), nil) QuitState.Obj = QuitButton quitState.SignalID = signal_connect_object(QuitState.Obj, "clicked", - SIGNAL_FUNC(widgetDestroy), window) + SIGNAL_FUNC(widgetDestroy), window).int32 QuitState.Disable = True discard signal_connect(disablebutton, "clicked", SIGNAL_FUNC(disablesignal), addr(QuitState)) diff --git a/examples/x11ex.nim b/examples/x11ex.nim index db51df2e01..a32094be49 100755 --- a/examples/x11ex.nim +++ b/examples/x11ex.nim @@ -5,7 +5,7 @@ const WINDOW_HEIGHT = 300 var - width, height: int + width, height: cint display: PDisplay screen: cint depth: int diff --git a/lib/system.nim b/lib/system.nim index 69733d6a1f..994127ea27 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -1156,9 +1156,11 @@ proc `$` *(x: int64): string {.magic: "Int64ToStr", noSideEffect.} ## The stingify operator for an integer argument. Returns `x` ## converted to a decimal string. -proc `$` *(x: uint64): string {.noSideEffect.} - ## The stingify operator for an unsigned integer argument. Returns `x` - ## converted to a decimal string. +when not defined(NimrodVM): + when not defined(ECMAScript): + proc `$` *(x: uint64): string {.noSideEffect.} + ## The stingify operator for an unsigned integer argument. Returns `x` + ## converted to a decimal string. proc `$` *(x: float): string {.magic: "FloatToStr", noSideEffect.} ## The stingify operator for a float argument. Returns `x` diff --git a/lib/windows/mmsystem.nim b/lib/windows/mmsystem.nim index c7dd5b1be8..91279a5ef3 100755 --- a/lib/windows/mmsystem.nim +++ b/lib/windows/mmsystem.nim @@ -2649,7 +2649,7 @@ proc MCI_TMSF_FRAME(tmsf: int32): int8 = result = toU8(tmsf shr 24) proc mci_Make_TMSF(t, m, s, f: int8): int32 = - result = ze(t) or ze(m) shl 8 or ze(s) shl 16 or ze(f) shl 24 + result = (ze(t) or ze(m) shl 8 or ze(s) shl 16 or ze(f) shl 24).int32 proc DIBINDEX(n: int32): int32 = result = n Or 0x000010FF'i32 shl 16'i32 diff --git a/lib/windows/shellapi.nim b/lib/windows/shellapi.nim index da31591764..41f2a60d5f 100755 --- a/lib/windows/shellapi.nim +++ b/lib/windows/shellapi.nim @@ -860,4 +860,4 @@ const # implementation proc EIRESID(x: int32): int32 = - result = - int(x) + result = -x diff --git a/tests/compile/tradix.nim b/tests/compile/tradix.nim index e7ca210e4f..379876ea10 100755 --- a/tests/compile/tradix.nim +++ b/tests/compile/tradix.nim @@ -12,8 +12,8 @@ type TRadixNode {.pure.} = object kind: TRadixNodeKind TRadixNodeLinear = object of TRadixNode - len: byte - keys: array [0..31, byte] + len: int8 + keys: array [0..31, int8] vals: array [0..31, PRadixNode] TRadixNodeFull = object of TRadixNode @@ -21,8 +21,8 @@ type TRadixNodeLeafBits = object of TRadixNode b: array [0..7, int] TRadixNodeLeafLinear = object of TRadixNode - len: byte - keys: array [0..31, byte] + len: int8 + keys: array [0..31, int8] var root: PRadixNode diff --git a/tests/compile/tstrset.nim b/tests/compile/tstrset.nim index e19ccee4d4..d81ab44c9e 100755 --- a/tests/compile/tstrset.nim +++ b/tests/compile/tstrset.nim @@ -6,7 +6,7 @@ type TRadixNode = object kind: TRadixNodeKind TRadixNodeLinear = object of TRadixNode - len: byte + len: int8 keys: array [0..31, char] vals: array [0..31, PRadixNode] TRadixNodeFull = object of TRadixNode diff --git a/tests/reject/tconstraints.nim b/tests/reject/tconstraints.nim index aafe86911e..e61095fffb 100755 --- a/tests/reject/tconstraints.nim +++ b/tests/reject/tconstraints.nim @@ -1,6 +1,6 @@ discard """ - line: 15 - errormsg: "type mismatch: got (int)" + line: 16 + errormsg: "type mismatch: got (int literal(232))" """ proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string = @@ -12,7 +12,7 @@ type var x: TMyObj -assert myGenericProc(232) == "232" assert myGenericProc(x) == "(x: 0, y: 0)" +assert myGenericProc(232) == "232" diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim index a8cc367834..957a255604 100755 --- a/tests/reject/tinvalidnewseq.nim +++ b/tests/reject/tinvalidnewseq.nim @@ -1,7 +1,7 @@ discard """ file: "tinvalidnewseq.nim" line: 15 - errormsg: "type mismatch: got (array[0..6, string], int)" + errormsg: "type mismatch: got (array[0..6, string], int literal(7))" """ import re, strutils diff --git a/tests/reject/tnamedparams.nim b/tests/reject/tnamedparams.nim index 5fb7699bad..9397fea4a9 100755 --- a/tests/reject/tnamedparams.nim +++ b/tests/reject/tnamedparams.nim @@ -1,7 +1,7 @@ discard """ file: "tnamedparams.nim" line: 8 - errormsg: "type mismatch: got (input: string, filename: string, line: int, col: int)" + errormsg: "type mismatch: got (input: string, filename: string, line: int literal(1), col: int literal(23))" """ import pegs diff --git a/tests/reject/tno_int_in_bool_context.nim b/tests/reject/tno_int_in_bool_context.nim index c539bb5560..755a02c0cb 100755 --- a/tests/reject/tno_int_in_bool_context.nim +++ b/tests/reject/tno_int_in_bool_context.nim @@ -1,6 +1,6 @@ discard """ line: 6 - errormsg: "type mismatch: got (int) but expected 'bool'" + errormsg: "type mismatch: got (int literal(1)) but expected 'bool'" """ if 1: diff --git a/tests/reject/tnolen.nim b/tests/reject/tnolen.nim index 4e81d7dd6b..e330865366 100644 --- a/tests/reject/tnolen.nim +++ b/tests/reject/tnolen.nim @@ -1,6 +1,6 @@ discard """ line: 8 - msg: "type mismatch: got (int)" + msg: "type mismatch: got (int literal(3))" """ # please finally disallow Len(3) diff --git a/tests/run/tuserassert.nim b/tests/run/tuserassert.nim index 80748189fa..8710ee4867 100644 --- a/tests/run/tuserassert.nim +++ b/tests/run/tuserassert.nim @@ -1,5 +1,5 @@ discard """ - output: "454 == 45ugh" + output: "x == 45ugh" """ template myAssert(cond: expr) = @@ -8,6 +8,6 @@ template myAssert(cond: expr) = if not cond: echo c, "ugh" - -myAssert(454 == 45) +var x = 454 +myAssert(x == 45)