feedback injected

This commit is contained in:
Arne Döring 2018-11-08 19:23:03 +01:00 • committed by Andreas Rumpf
commit b306e0bfe2
3 changed files with 3 additions and 4 deletions

View file

@ -146,8 +146,6 @@ proc mapType(conf: ConfigRef; typ: PType): TCTypeKind =
return mapType(conf, typ.lastSon) return mapType(conf, typ.lastSon)
of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal, of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal,
tyTypeDesc, tyAlias, tySink, tyInferred: tyTypeDesc, tyAlias, tySink, tyInferred:
if typ.sons.len == 0:
internalError(conf, "typ has no last son")
result = mapType(conf, lastSon(typ)) result = mapType(conf, lastSon(typ))
of tyEnum: of tyEnum:
if firstOrd(conf, typ) < 0: if firstOrd(conf, typ) < 0:

View file

@ -571,6 +571,7 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode =
let e = semExpr(c, n.sons[i]) let e = semExpr(c, n.sons[i])
if e.typ == nil: if e.typ == nil:
localError(c.config, e.info, "expression has no type") localError(c.config, e.info, "expression has no type")
else:
n.sons[i].typ = e.typ.skipTypes({tyTypeDesc}) n.sons[i].typ = e.typ.skipTypes({tyTypeDesc})
var s = s var s = s
var a = n.sons[0] var a = n.sons[0]

View file

@ -1540,7 +1540,7 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
var le = a.typ var le = a.typ
if le == nil: if le == nil:
localError(c.config, a.info, "expression has no type") 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 isAssignable(c, a) == arNone) or
skipTypes(le, abstractVar).kind in {tyOpenArray, tyVarargs}: skipTypes(le, abstractVar).kind in {tyOpenArray, tyVarargs}:
# Direct assignment to a discriminant is allowed! # Direct assignment to a discriminant is allowed!