diff options
-rw-r--r-- | compiler/semexprs.nim | 5 | ||||
-rw-r--r-- | tests/modules/morder_depa.nim | 5 | ||||
-rw-r--r-- | tests/modules/morder_depb.nim | 1 | ||||
-rw-r--r-- | tests/modules/torder_dep.nim | 10 |
4 files changed, 19 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 2b74846bd..118ebbcc1 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2598,9 +2598,10 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result = semTemplateExpr(c, n, s, flags) of skType: # XXX think about this more (``set`` procs) - if n.len == 2: + let ambig = contains(c.ambiguousSymbols, s.id) + if not (n[0].kind in {nkClosedSymChoice, nkOpenSymChoice, nkIdent} and ambig) and n.len == 2: result = semConv(c, n) - elif contains(c.ambiguousSymbols, s.id) and n.len == 1: + elif ambig and n.len == 1: errorUseQualifier(c, n.info, s) elif n.len == 1: result = semObjConstr(c, n, flags) diff --git a/tests/modules/morder_depa.nim b/tests/modules/morder_depa.nim new file mode 100644 index 000000000..846fb1441 --- /dev/null +++ b/tests/modules/morder_depa.nim @@ -0,0 +1,5 @@ + +import morder_depb + +proc Foo*(x: int): Foo = discard + diff --git a/tests/modules/morder_depb.nim b/tests/modules/morder_depb.nim new file mode 100644 index 000000000..b77bc5acb --- /dev/null +++ b/tests/modules/morder_depb.nim @@ -0,0 +1 @@ +type Foo* = array[2, byte] diff --git a/tests/modules/torder_dep.nim b/tests/modules/torder_dep.nim new file mode 100644 index 000000000..85211228a --- /dev/null +++ b/tests/modules/torder_dep.nim @@ -0,0 +1,10 @@ +discard """ + output: '''[0, 0]''' +""" + +import morder_depb +import morder_depa + +# bug #11187 + +echo Foo(3) |