diff options
-rw-r--r-- | compiler/ccgtypes.nim | 2 | ||||
-rw-r--r-- | compiler/semcall.nim | 3 | ||||
-rw-r--r-- | compiler/semexprs.nim | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index decf5688a..386d7f60c 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -146,8 +146,6 @@ proc mapType(conf: ConfigRef; typ: PType): TCTypeKind = return mapType(conf, typ.lastSon) of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tySink, tyInferred: - if typ.sons.len == 0: - internalError(conf, "typ has no last son") result = mapType(conf, lastSon(typ)) of tyEnum: if firstOrd(conf, typ) < 0: diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 5e3e8b65b..214affb19 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -571,7 +571,8 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode = let e = semExpr(c, n.sons[i]) if e.typ == nil: localError(c.config, e.info, "expression has no type") - n.sons[i].typ = e.typ.skipTypes({tyTypeDesc}) + else: + n.sons[i].typ = e.typ.skipTypes({tyTypeDesc}) var s = s var a = n.sons[0] if a.kind == nkSym: diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 504a54813..0cf601251 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1540,7 +1540,7 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode = var le = a.typ if le == nil: localError(c.config, a.info, "expression has no type") - if (skipTypes(le, {tyGenericInst, tyAlias, tySink}).kind != tyVar and + elif (skipTypes(le, {tyGenericInst, tyAlias, tySink}).kind != tyVar and isAssignable(c, a) == arNone) or skipTypes(le, abstractVar).kind in {tyOpenArray, tyVarargs}: # Direct assignment to a discriminant is allowed! |