diff options
-rw-r--r-- | compiler/semtypes.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 92a36857a..b032557b7 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1420,9 +1420,13 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = else: result = semGeneric(c, n, s, prev) of nkDotExpr: let typeExpr = semExpr(c, n) - if typeExpr.typ.kind == tyFromExpr: - return typeExpr.typ - if typeExpr.typ.kind != tyTypeDesc: + if typeExpr.typ.isNil: + localError(n.info, "object constructor needs an object type;" & + " for named arguments use '=' instead of ':'") + result = errorType(c) + elif typeExpr.typ.kind == tyFromExpr: + result = typeExpr.typ + elif typeExpr.typ.kind != tyTypeDesc: localError(n.info, errTypeExpected) result = errorType(c) else: |