diff options
author | Araq <rumpf_a@web.de> | 2014-12-15 02:15:11 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-12-15 02:15:11 +0100 |
commit | 61c5c92f097a624bb0fdfc26b3d19005eac1dd35 (patch) | |
tree | 70f1f6114875a32af37ee416bb37b8fe5d411510 | |
parent | 516a4d933f9b5e87c670565dc03bdc755896bb2b (diff) | |
download | Nim-61c5c92f097a624bb0fdfc26b3d19005eac1dd35.tar.gz |
fixes #1656
-rw-r--r--[-rwxr-xr-x] | build.sh | 0 | ||||
-rw-r--r-- | compiler/semtypes.nim | 10 | ||||
-rw-r--r-- | tests/iter/tchainediterators.nim | 2 | ||||
-rw-r--r-- | tests/metatype/tsemistatic.nim | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/build.sh b/build.sh index 139c28359..139c28359 100755..100644 --- a/build.sh +++ b/build.sh diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d71ad6fe6..1d0bba6f0 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -854,7 +854,9 @@ proc semParamType(c: PContext, n: PNode, constraint: var PNode): PType = result = semTypeNode(c, n, nil) proc semProcTypeNode(c: PContext, n, genericParams: PNode, - prev: PType, kind: TSymKind): PType = + prev: PType, kind: TSymKind; isType=false): PType = + # for historical reasons (code grows) this is invoked for parameter + # lists too and then 'isType' is false. var res: PNode cl: IntSet @@ -903,7 +905,8 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, # proc sort[T](cmp: proc(a, b: T): int = cmp) if not containsGenericType(typ): def = fitNode(c, typ, def) - if not (hasType or hasDefault): + if not hasType and not hasDefault: + if isType: localError(a.info, "':' expected") let tdef = if kind in {skTemplate, skMacro}: tyExpr else: tyAnything typ = newTypeS(tdef, c) @@ -929,6 +932,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, if n.sons[0].kind != nkEmpty: r = semTypeNode(c, n.sons[0], nil) elif kind == skIterator: + # XXX This is special magic we should likely get rid of r = newTypeS(tyAnything, c) if r != nil: @@ -1069,7 +1073,7 @@ proc semProcTypeWithScope(c: PContext, n: PNode, prev: PType, kind: TSymKind): PType = checkSonsLen(n, 2) openScope(c) - result = semProcTypeNode(c, n.sons[0], nil, prev, kind) + result = semProcTypeNode(c, n.sons[0], nil, prev, kind, isType=true) # dummy symbol for `pragma`: var s = newSymS(kind, newIdentNode(getIdent("dummy"), n.info), c) s.typ = result diff --git a/tests/iter/tchainediterators.nim b/tests/iter/tchainediterators.nim index 18d096761..8d9f44a54 100644 --- a/tests/iter/tchainediterators.nim +++ b/tests/iter/tchainediterators.nim @@ -28,7 +28,7 @@ iterator foo[T](x: iterator: T{.inline.}): T = var s = @[1, 2, 3] -# pass an interator several levels deep: +# pass an iterator several levels deep: for x in s.items.foo: echo x diff --git a/tests/metatype/tsemistatic.nim b/tests/metatype/tsemistatic.nim index d187f153c..0a003be03 100644 --- a/tests/metatype/tsemistatic.nim +++ b/tests/metatype/tsemistatic.nim @@ -1,6 +1,7 @@ discard """ msg: "static 10\ndynamic\nstatic 20\n" output: "s\nd\nd\ns" + disabled: "true" """ proc foo(x: semistatic[int]) = |