restore compilation and make all concepts tests green

This commit is contained in:
Zahary Karadjov
2017-01-27 01:17:34 +02:00
parent d6d548c32f
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)])
else: addf(m.s[cfsTypes], "typedef NU8 $1[$2];$n",
[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)
else:
internalError("getTypeDescAux(" & $t.kind & ')')

View File

@@ -72,8 +72,8 @@ type # please make sure we have under 32 options
TGlobalOptions* = set[TGlobalOption]
const
harmlessOptions* = {optForceFullMake, optNoLinking, optReportConceptFailures,
optRun, optUseColors, optStdout}
harmlessOptions* = {optForceFullMake, optNoLinking, optRun,
optUseColors, optStdout}
type
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
# to be resolvable while matching the rest of the parameters
for p in typeParams:
put(m.bindings, p[1], p[0].typ)
put(m, p[1], p[0].typ)
if ff.kind == tyUserTypeClassInst:
result = generateTypeInstance(c, m.bindings, Concept.sym.info, ff)
@@ -831,7 +831,7 @@ proc inferStaticsInRange(c: var TCandidate,
var rhs = r
var inferred = inferStaticParam(exp, rhs)
if inferred != nil:
put(c.bindings, inferred, inferred)
put(c, inferred, inferred)
return isGeneric
else:
failureToInferStaticParam exp
@@ -1612,8 +1612,8 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
if a.kind == tyStatic:
if m.callee.kind == tyGenericBody and
argType.n == nil and
tfGenericTypeParam notin argType.flags:
a.n == nil and
tfGenericTypeParam notin a.flags:
return newNodeIT(nkType, argOrig.info, makeTypeFromExpr(c, arg))
else:
var evaluated = c.semTryConstExpr(c, arg)

View File

@@ -1,60 +1,60 @@
discard """
cmd: "nim c --verbosity:0 --colors:off $file"
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
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
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed
texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
texplain.nim(65, 5) ExplainedConcept: type class predicate failed
texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
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
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed
texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo'
texplain.nim(65, 6) ExplainedConcept: undeclared field: '.'
texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called
texplain.nim(65, 5) ExplainedConcept: type class predicate failed
texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar'
texplain.nim(66, 6) ExplainedConcept: undeclared field: '.'
texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called
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:
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
tests/concepts/texplain.nim(110, 20) Error: type mismatch: got (NonMatchingType)
texplain.nim(110, 20) Error: type mismatch: got (NonMatchingType)
but expected one of:
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(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(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:
proc f(o: NestedConcept)
tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: 'foo'
tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: '.'
tests/concepts/texplain.nim(69, 6) RegularConcept: expression '.' cannot be called
tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed
tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: 'bar'
tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: '.'
tests/concepts/texplain.nim(70, 6) RegularConcept: expression '.' cannot be called
tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed
tests/concepts/texplain.nim(73, 5) NestedConcept: type class predicate failed
texplain.nim(69, 6) RegularConcept: undeclared field: 'foo'
texplain.nim(69, 6) RegularConcept: undeclared field: '.'
texplain.nim(69, 6) RegularConcept: expression '.' cannot be called
texplain.nim(69, 5) RegularConcept: type class predicate failed
texplain.nim(70, 6) RegularConcept: undeclared field: 'bar'
texplain.nim(70, 6) RegularConcept: undeclared field: '.'
texplain.nim(70, 6) RegularConcept: expression '.' cannot be called
texplain.nim(69, 5) RegularConcept: type class predicate failed
texplain.nim(73, 5) NestedConcept: type class predicate failed
'''
line: 119
errormsg: "type mismatch: got (MatchingType)"