File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ proc semLocal(c: var SemContext; n: var Cursor; kind: SymKind) =
8787 if n.kind == DotToken :
8888 # no explicit type given:
8989 inc n # 3
90+ let orig = n
9091 var it = Item (n: n, typ: c.types.autoType)
9192 if kind == ConstY :
9293 withNewScope c:
@@ -95,6 +96,8 @@ proc semLocal(c: var SemContext; n: var Cursor; kind: SymKind) =
9596 semLocalValue c, it, crucial # 4
9697 n = it.n
9798 let typ = skipModifier (it.typ)
99+ if classifyType (c, typ) == VoidT :
100+ c.buildErr n.info, " expression '" & asNimCode (orig) & " ' has no type (or is ambiguous)"
98101 insertType c, typ, beforeType
99102 else :
100103 let typ = semLocalType (c, n) # 3
Original file line number Diff line number Diff line change 1+ tests/nimony/errmsgs/tlocalvoid.nim(5, 5) Error: expression 'foo()' has no type (or is ambiguous)
Original file line number Diff line number Diff line change 1+ import std / [assertions]
2+
3+ proc foo = discard
4+
5+ var x = foo ()
You can’t perform that action at this time.
0 commit comments