bugfix: object constructor doesn't allow 'distinct' types

This commit is contained in:
Araq
2014-02-01 11:56:21 +01:00
parent ad74332a92
commit d8d93218fa

View File

@@ -1709,8 +1709,8 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
result = n
result.typ = t
result.kind = nkObjConstr
t = skipTypes(t, abstractInst)
if t.kind == tyRef: t = skipTypes(t.sons[0], abstractInst)
t = skipTypes(t, {tyGenericInst})
if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst})
if t.kind != tyObject:
localError(n.info, errGenerated, "object constructor needs an object type")
return