This commit is contained in:
Araq 2012-01-07 20:30:51 +01:00
commit 7f3b3298b4
3 changed files with 29 additions and 26 deletions

View file

@ -547,10 +547,11 @@ type
proc handleError(msg: TMsgKind, eh: TErrorHandling) =
if msg == errInternal:
assert(false) # we want a stack trace here
if (msg >= fatalMin) and (msg <= fatalMax):
if msg >= fatalMin and msg <= fatalMax:
if gVerbosity >= 3: assert(false)
quit(1)
if (msg >= errMin) and (msg <= errMax):
if msg >= errMin and msg <= errMax:
if gVerbosity >= 3: assert(false)
inc(gErrorCounter)
options.gExitcode = 1'i8
if gErrorCounter >= gErrorMax or eh == doAbort:

View file

@ -625,14 +625,18 @@ proc semGenericParamInInvokation(c: PContext, n: PNode): PType =
result = semTypeNode(c, n, nil)
proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
if s.typ == nil or s.typ.kind != tyGenericBody:
GlobalError(n.info, errCannotInstantiateX, s.name.s)
result = newOrPrevType(tyGenericInvokation, prev, c)
if s.typ.containerID == 0: InternalError(n.info, "semtypes.semGeneric")
if sonsLen(n) != sonsLen(s.typ):
var isConcrete = true
if s.typ == nil:
GlobalError(n.info, errCannotInstantiateX, s.name.s)
elif s.typ.kind != tyGenericBody:
isConcrete = false
elif s.typ.containerID == 0:
InternalError(n.info, "semtypes.semGeneric")
elif sonsLen(n) != sonsLen(s.typ):
GlobalError(n.info, errWrongNumberOfArguments)
addSon(result, s.typ)
var isConcrete = true # iterate over arguments:
# iterate over arguments:
for i in countup(1, sonsLen(n)-1):
var elem = semGenericParamInInvokation(c, n.sons[i])
if containsGenericType(elem): isConcrete = false