diff options
-rwxr-xr-x | compiler/ccgtypes.nim | 2 | ||||
-rwxr-xr-x | compiler/types.nim | 5 | ||||
-rwxr-xr-x | lib/system.nim | 8 | ||||
-rw-r--r-- | tests/reject/tenummix.nim | 9 | ||||
-rw-r--r-- | tests/run/tdumptree.nim | 3 | ||||
-rwxr-xr-x | todo.txt | 7 |
6 files changed, 21 insertions, 13 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index fc09d9a5d..4492c2fea 100755 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -144,7 +144,7 @@ proc mapSetType(typ: PType): TCTypeKind = proc mapType(typ: PType): TCTypeKind = case typ.kind - of tyNone: result = ctVoid + of tyNone, tyStmt: result = ctVoid of tyBool: result = ctBool of tyChar: result = ctChar of tySet: result = mapSetType(typ) diff --git a/compiler/types.nim b/compiler/types.nim index 61e42ac0a..b3737b134 100755 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -869,8 +869,9 @@ proc typeAllowedAux(marker: var TIntSet, typ: PType, kind: TSymKind): bool = result = typeAllowedAux(marker, t.sons[0], skResult) of tyExpr, tyStmt, tyTypeDesc: result = true - of tyGenericBody, tyGenericParam, tyForward, tyNone, tyGenericInvokation, tyTypeClass: - result = false #InternalError('shit found'); + of tyGenericBody, tyGenericParam, tyForward, tyNone, tyGenericInvokation, + tyTypeClass: + result = false of tyEmpty, tyNil: result = kind == skConst of tyString, tyBool, tyChar, tyEnum, tyInt..tyBigNum, tyCString, tyPointer: diff --git a/lib/system.nim b/lib/system.nim index 0c6aea750..9a9984911 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -2184,19 +2184,19 @@ proc `*=`*[T](x: var ordinal[T], y: ordinal[T]) {.inline, noSideEffect.} = ## Binary `*=` operator for ordinals x = x * y -proc `+=` *(x: var float, y:float) {.inline, noSideEffect.} = +proc `+=`*[T: float|float32|float64] (x: var T, y: T) {.inline, noSideEffect.} = ## Increments in placee a floating point number x = x + y -proc `-=` *(x: var float, y:float) {.inline, noSideEffect.} = +proc `-=`*[T: float|float32|float64] (x: var T, y: T) {.inline, noSideEffect.} = ## Decrements in place a floating point number x = x - y -proc `*=` *(x: var float, y:float) {.inline, noSideEffect.} = +proc `*=`*[T: float|float32|float64] (x: var T, y: T) {.inline, noSideEffect.} = ## Multiplies in place a floating point number x = x * y -proc `/=` *(x: var float, y:float) {.inline, noSideEffect.} = +proc `/=`*[T: float|float32|float64] (x: var T, y: T) {.inline, noSideEffect.} = ## Divides in place a floating point number x = x / y diff --git a/tests/reject/tenummix.nim b/tests/reject/tenummix.nim new file mode 100644 index 000000000..52d4f39d7 --- /dev/null +++ b/tests/reject/tenummix.nim @@ -0,0 +1,9 @@ +discard """ + errormsg: "type mismatch" +""" + +type + TE1 = enum eA, eB + TE2 = enum eC, eD + +assert eA != eC diff --git a/tests/run/tdumptree.nim b/tests/run/tdumptree.nim index 2a9c7d205..5299a94e3 100644 --- a/tests/run/tdumptree.nim +++ b/tests/run/tdumptree.nim @@ -1,4 +1,5 @@ discard """ +disabled: true output: '''StmtList VarSection IdentDefs @@ -11,6 +12,8 @@ output: '''StmtList IntLit 56''' """ +# disabled; can't work as the output is done by the compiler + import macros #emit("type\n TFoo = object\n bar: int") diff --git a/todo.txt b/todo.txt index 5f1d7adde..68a3b93b0 100755 --- a/todo.txt +++ b/todo.txt @@ -33,14 +33,9 @@ version 0.9.0 error handling more light-weight people also want ``inc a; inc b`` + Bugs ---- -- bug: returning a tyVar does not mean it is save to return it: - proc forward[T](x: var T): var T = result = x - proc p(): var int = - var x: int - # reject this call via alias analysis: - result = forward(x) - bug: stress testing basic method example (eval example) without ``-d:release`` leaks memory? |