make concepts tests green again
This commit is contained in:
parent
ae82406c8b
commit
6b8167aaa1
2 changed files with 15 additions and 15 deletions
|
|
@ -5,17 +5,9 @@ t3330.nim(63, 4) Error: type mismatch: got <Bar[system.int]>
|
||||||
but expected one of:
|
but expected one of:
|
||||||
proc test(foo: Foo[int])
|
proc test(foo: Foo[int])
|
||||||
t3330.nim(48, 8) Hint: Non-matching candidates for add(k, string, T)
|
t3330.nim(48, 8) Hint: Non-matching candidates for add(k, string, T)
|
||||||
proc add(x: var string; y: string)
|
proc add[T](x: var seq[T]; y: openArray[T])
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type: var string
|
required type: var seq[T]
|
||||||
but expression 'k' is of type: Alias
|
|
||||||
proc add(x: var string; y: char)
|
|
||||||
first type mismatch at position: 1
|
|
||||||
required type: var string
|
|
||||||
but expression 'k' is of type: Alias
|
|
||||||
proc add(result: var string; x: int64)
|
|
||||||
first type mismatch at position: 1
|
|
||||||
required type: var string
|
|
||||||
but expression 'k' is of type: Alias
|
but expression 'k' is of type: Alias
|
||||||
proc add(result: var string; x: float)
|
proc add(result: var string; x: float)
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
|
|
@ -25,14 +17,22 @@ proc add(x: var string; y: cstring)
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type: var string
|
required type: var string
|
||||||
but expression 'k' is of type: Alias
|
but expression 'k' is of type: Alias
|
||||||
proc add[T](x: var seq[T]; y: openArray[T])
|
proc add(x: var string; y: char)
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type: var seq[T]
|
required type: var string
|
||||||
|
but expression 'k' is of type: Alias
|
||||||
|
proc add(x: var string; y: string)
|
||||||
|
first type mismatch at position: 1
|
||||||
|
required type: var string
|
||||||
but expression 'k' is of type: Alias
|
but expression 'k' is of type: Alias
|
||||||
proc add[T](x: var seq[T]; y: T)
|
proc add[T](x: var seq[T]; y: T)
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type: var seq[T]
|
required type: var seq[T]
|
||||||
but expression 'k' is of type: Alias
|
but expression 'k' is of type: Alias
|
||||||
|
proc add(result: var string; x: int64)
|
||||||
|
first type mismatch at position: 1
|
||||||
|
required type: var string
|
||||||
|
but expression 'k' is of type: Alias
|
||||||
|
|
||||||
t3330.nim(48, 8) template/generic instantiation from here
|
t3330.nim(48, 8) template/generic instantiation from here
|
||||||
t3330.nim(55, 6) Foo: 'bar.value' cannot be assigned to
|
t3330.nim(55, 6) Foo: 'bar.value' cannot be assigned to
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ type
|
||||||
data: array[M*K, T]
|
data: array[M*K, T]
|
||||||
|
|
||||||
# adaptor for the concept's non-matching expectations
|
# adaptor for the concept's non-matching expectations
|
||||||
template N(M: type MyMatrix): expr = M.K
|
template N(M: type MyMatrix): untyped = M.K
|
||||||
|
|
||||||
proc `[]`(m: MyMatrix; r, c: int): m.T =
|
proc `[]`(m: MyMatrix; r, c: int): m.T =
|
||||||
m.data[r * m.K + c]
|
m.data[r * m.K + c]
|
||||||
|
|
@ -45,7 +45,7 @@ proc foo(x: MyMatrix, arr: array[15, x.T]) = discard
|
||||||
proc genericMatrixProc[R, C, TE, FF, FC, T](m: Matrix[R, C, TE, FF, FC, T]): T =
|
proc genericMatrixProc[R, C, TE, FF, FC, T](m: Matrix[R, C, TE, FF, FC, T]): T =
|
||||||
static:
|
static:
|
||||||
echo "R=", R, " C=", C, " TE=", TE, " FF=", FF, " FC=", FC, " T=", T.name
|
echo "R=", R, " C=", C, " TE=", TE, " FF=", FF, " FC=", FC, " T=", T.name
|
||||||
|
|
||||||
m[0, 0]
|
m[0, 0]
|
||||||
|
|
||||||
proc implicitMatrixProc(m: Matrix): m.T =
|
proc implicitMatrixProc(m: Matrix): m.T =
|
||||||
|
|
@ -57,7 +57,7 @@ proc implicitMatrixProc(m: Matrix): m.T =
|
||||||
#" FF=", m.FromFoo,
|
#" FF=", m.FromFoo,
|
||||||
#" FC=", m.FromConst,
|
#" FC=", m.FromConst,
|
||||||
" T=", m.T.name
|
" T=", m.T.name
|
||||||
|
|
||||||
m[0, 0]
|
m[0, 0]
|
||||||
|
|
||||||
proc myMatrixProc(x: MyMatrix): MyMatrix.T = genericMatrixProc(x)
|
proc myMatrixProc(x: MyMatrix): MyMatrix.T = genericMatrixProc(x)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue