mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
make concepts tests green again
This commit is contained in:
@@ -5,17 +5,9 @@ t3330.nim(63, 4) Error: type mismatch: got <Bar[system.int]>
|
||||
but expected one of:
|
||||
proc test(foo: Foo[int])
|
||||
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
|
||||
required type: var string
|
||||
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
|
||||
required type: var seq[T]
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(result: var string; x: float)
|
||||
first type mismatch at position: 1
|
||||
@@ -25,14 +17,22 @@ proc add(x: var string; y: cstring)
|
||||
first type mismatch at position: 1
|
||||
required type: var string
|
||||
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
|
||||
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
|
||||
proc add[T](x: var seq[T]; y: T)
|
||||
first type mismatch at position: 1
|
||||
required type: var seq[T]
|
||||
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(55, 6) Foo: 'bar.value' cannot be assigned to
|
||||
|
||||
@@ -32,7 +32,7 @@ type
|
||||
data: array[M*K, T]
|
||||
|
||||
# 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 =
|
||||
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 =
|
||||
static:
|
||||
echo "R=", R, " C=", C, " TE=", TE, " FF=", FF, " FC=", FC, " T=", T.name
|
||||
|
||||
|
||||
m[0, 0]
|
||||
|
||||
proc implicitMatrixProc(m: Matrix): m.T =
|
||||
@@ -57,7 +57,7 @@ proc implicitMatrixProc(m: Matrix): m.T =
|
||||
#" FF=", m.FromFoo,
|
||||
#" FC=", m.FromConst,
|
||||
" T=", m.T.name
|
||||
|
||||
|
||||
m[0, 0]
|
||||
|
||||
proc myMatrixProc(x: MyMatrix): MyMatrix.T = genericMatrixProc(x)
|
||||
|
||||
Reference in New Issue
Block a user