restore compilation and make all concepts tests green

This commit is contained in:
Zahary Karadjov 2017-01-27 01:17:34 +02:00
commit c605d57574
4 changed files with 42 additions and 41 deletions

View file

@ -790,7 +790,8 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
of 1, 2, 4, 8: addf(m.s[cfsTypes], "typedef NU$2 $1;$n", [result, rope(s*8)]) of 1, 2, 4, 8: addf(m.s[cfsTypes], "typedef NU$2 $1;$n", [result, rope(s*8)])
else: addf(m.s[cfsTypes], "typedef NU8 $1[$2];$n", else: addf(m.s[cfsTypes], "typedef NU8 $1[$2];$n",
[result, rope(getSize(t))]) [result, rope(getSize(t))])
of tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias: of tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias,
tyUserTypeClass, tyUserTypeClassInst, tyInferred:
result = getTypeDescAux(m, lastSon(t), check) result = getTypeDescAux(m, lastSon(t), check)
else: else:
internalError("getTypeDescAux(" & $t.kind & ')') internalError("getTypeDescAux(" & $t.kind & ')')

View file

@ -72,8 +72,8 @@ type # please make sure we have under 32 options
TGlobalOptions* = set[TGlobalOption] TGlobalOptions* = set[TGlobalOption]
const const
harmlessOptions* = {optForceFullMake, optNoLinking, optReportConceptFailures, harmlessOptions* = {optForceFullMake, optNoLinking, optRun,
optRun, optUseColors, optStdout} optUseColors, optStdout}
type type
TCommands* = enum # Nim's commands TCommands* = enum # Nim's commands

View file

@ -701,7 +701,7 @@ proc matchUserTypeClass*(c: PContext, m: var TCandidate,
# We need to put them in the current sigmatch's binding table in order for them # We need to put them in the current sigmatch's binding table in order for them
# to be resolvable while matching the rest of the parameters # to be resolvable while matching the rest of the parameters
for p in typeParams: for p in typeParams:
put(m.bindings, p[1], p[0].typ) put(m, p[1], p[0].typ)
if ff.kind == tyUserTypeClassInst: if ff.kind == tyUserTypeClassInst:
result = generateTypeInstance(c, m.bindings, Concept.sym.info, ff) result = generateTypeInstance(c, m.bindings, Concept.sym.info, ff)
@ -831,7 +831,7 @@ proc inferStaticsInRange(c: var TCandidate,
var rhs = r var rhs = r
var inferred = inferStaticParam(exp, rhs) var inferred = inferStaticParam(exp, rhs)
if inferred != nil: if inferred != nil:
put(c.bindings, inferred, inferred) put(c, inferred, inferred)
return isGeneric return isGeneric
else: else:
failureToInferStaticParam exp failureToInferStaticParam exp
@ -1612,8 +1612,8 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
if a.kind == tyStatic: if a.kind == tyStatic:
if m.callee.kind == tyGenericBody and if m.callee.kind == tyGenericBody and
argType.n == nil and a.n == nil and
tfGenericTypeParam notin argType.flags: tfGenericTypeParam notin a.flags:
return newNodeIT(nkType, argOrig.info, makeTypeFromExpr(c, arg)) return newNodeIT(nkType, argOrig.info, makeTypeFromExpr(c, arg))
else: else:
var evaluated = c.semTryConstExpr(c, arg) var evaluated = c.semTryConstExpr(c, arg)

View file

@ -1,60 +1,60 @@
discard """ discard """
cmd: "nim c --verbosity:0 --colors:off $file" cmd: "nim c --verbosity:0 --colors:off $file"
nimout: ''' nimout: '''
tests/concepts/texplain.nim(99, 10) Hint: Non-matching candidates for e(y) texplain.nim(99, 10) Hint: Non-matching candidates for e(y)
proc e(i: int): int proc e(i: int): int
tests/concepts/texplain.nim(102, 7) Hint: Non-matching candidates for e(10) texplain.nim(102, 7) Hint: Non-matching candidates for e(10)
proc e(o: ExplainedConcept): int proc e(o: ExplainedConcept): int
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo' texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.' texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar' texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.' texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(105, 10) Hint: Non-matching candidates for e(10) texplain.nim(105, 10) Hint: Non-matching candidates for e(10)
proc e(o: ExplainedConcept): int proc e(o: ExplainedConcept): int
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo' texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.' texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar' texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.' texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(109, 20) Error: type mismatch: got (NonMatchingType) texplain.nim(109, 20) Error: type mismatch: got (NonMatchingType)
but expected one of: but expected one of:
proc e(o: ExplainedConcept): int proc e(o: ExplainedConcept): int
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed texplain.nim(65, 5) ExplainedConcept: type class predicate failed
proc e(i: int): int proc e(i: int): int
tests/concepts/texplain.nim(110, 20) Error: type mismatch: got (NonMatchingType) texplain.nim(110, 20) Error: type mismatch: got (NonMatchingType)
but expected one of: but expected one of:
proc r(o: RegularConcept): int proc r(o: RegularConcept): int
tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed texplain.nim(69, 5) RegularConcept: type class predicate failed
proc r[T](a: SomeNumber; b: T; c: auto) proc r[T](a: SomeNumber; b: T; c: auto)
proc r(i: string): int proc r(i: string): int
tests/concepts/texplain.nim(111, 20) Hint: Non-matching candidates for r(y) texplain.nim(111, 20) Hint: Non-matching candidates for r(y)
proc r[T](a: SomeNumber; b: T; c: auto) proc r[T](a: SomeNumber; b: T; c: auto)
proc r(i: string): int proc r(i: string): int
tests/concepts/texplain.nim(119, 2) Error: type mismatch: got (MatchingType) texplain.nim(119, 2) Error: type mismatch: got (MatchingType)
but expected one of: but expected one of:
proc f(o: NestedConcept) proc f(o: NestedConcept)
tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: 'foo' texplain.nim(69, 6) RegularConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: '.' texplain.nim(69, 6) RegularConcept: undeclared field: '.'
tests/concepts/texplain.nim(69, 6) RegularConcept: expression '.' cannot be called texplain.nim(69, 6) RegularConcept: expression '.' cannot be called
tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed texplain.nim(69, 5) RegularConcept: type class predicate failed
tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: 'bar' texplain.nim(70, 6) RegularConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: '.' texplain.nim(70, 6) RegularConcept: undeclared field: '.'
tests/concepts/texplain.nim(70, 6) RegularConcept: expression '.' cannot be called texplain.nim(70, 6) RegularConcept: expression '.' cannot be called
tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed texplain.nim(69, 5) RegularConcept: type class predicate failed
tests/concepts/texplain.nim(73, 5) NestedConcept: type class predicate failed texplain.nim(73, 5) NestedConcept: type class predicate failed
''' '''
line: 119 line: 119
errormsg: "type mismatch: got (MatchingType)" errormsg: "type mismatch: got (MatchingType)"