-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test case haul to prevent pileup (#24525)
closes #6013, closes #7009, closes #9190, closes #12487, closes #12831, closes #13184, closes #13252, closes #14860, closes #14877, closes #14894, closes #14917, closes #16153, closes #16439, closes #17779, closes #18074, closes #18202, closes #18314, closes #18648, closes #19063, closes #19446, closes #20065, closes #20367, closes #22126, closes #22820, closes #22888, closes #23020, closes #23287, closes #23510
- Loading branch information
Showing
27 changed files
with
393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
block: # issue #13184 | ||
type | ||
TypeClass = uint | enum | int | ||
ArrayAlias[I: TypeClass] = array[I, int] | ||
|
||
proc test[I: TypeClass](points: ArrayAlias[I]) = | ||
discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
discard """ | ||
action: compile | ||
targets: "cpp" | ||
matrix: "--compileOnly" | ||
""" | ||
|
||
# issue #20065 | ||
|
||
type | ||
Foo* {.importC, nodecl.} = object # doesn't matter if this is importC or importCpp | ||
value*: int64 | ||
Bar* {.importCpp, nodecl.} = object # no segfault with importC | ||
foo*: Foo | ||
|
||
discard @[Bar()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Y* = object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type Y* = object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# issue #23510 | ||
|
||
import ./mambtype1 | ||
import ./mambtype2 | ||
|
||
proc u(d: int | int) = | ||
var r: Y #[tt.Error | ||
^ ambiguous identifier: 'Y' -- use one of the following: | ||
mambtype1.Y: Y | ||
mambtype2.Y: Y]# | ||
static: doAssert r is j.Y # because j is imported first | ||
doAssert r is j.Y | ||
|
||
u(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# issue #16439 | ||
|
||
import std/[strutils, sequtils] | ||
var data = "aaa aaa" | ||
echo data.split(" ").map(toSeq) #[tt.Error | ||
^ type mismatch: got <seq[string], template (iter: untyped): untyped>]# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
discard """ | ||
output: ''' | ||
L | ||
L | ||
L | ||
L | ||
B | ||
B | ||
B | ||
B | ||
''' | ||
""" | ||
|
||
# issue #18202 | ||
|
||
type | ||
R = object | ||
S = object | ||
U = R | S | ||
|
||
L = object | ||
B = object | ||
C = B | L | ||
|
||
proc f(n: L, q: R | S) = echo "L" | ||
proc f(n: B, q: R | S) = echo "B" | ||
|
||
proc g(n: C, q: R | S) = echo (when n is L: "L" else: "B") | ||
|
||
proc h(n: L, q: U) = echo "L" | ||
proc h(n: B, q: U) = echo "B" | ||
|
||
proc j(n: C, q: U) = echo (when n is L: "L" else: "B") | ||
|
||
proc e(n: B | L, a: R) = | ||
template t(operations: untyped, fn: untyped) = fn(n, operations) | ||
|
||
# Work as expected | ||
t(a, f) | ||
t(a, g) | ||
t(a, j) | ||
|
||
# Error: type mismatch: got <R, proc [*missing parameters*](n: B, q: U) | proc [*missing parameters*](n: L, q: U)> | ||
t(a, h) | ||
|
||
e(L(), R()) | ||
e(B(), R()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# issue #14860 | ||
|
||
type | ||
Dummie = object | ||
|
||
iterator `[]`(d: Dummie, a, b: int): int = discard | ||
|
||
let d = Dummie() | ||
|
||
for s in d[0, 1]: discard # error here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# issue #19063 | ||
|
||
iterator items[T]*(s: seq[T]): T = #[tt.Error | ||
^ invalid indentation; an export marker '*' follows the declared identifier]# | ||
for i in system.items(s): | ||
yield i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# issue #12831 | ||
|
||
import std/[macros, strutils] | ||
|
||
macro dumpRepr(x: typed): untyped = | ||
result = newLit(x.treeRepr & "\n") | ||
doAssert dumpRepr(`$`).startsWith("ClosedSymChoice") | ||
|
||
# issue #19446 | ||
|
||
macro typedVarargs(x: varargs[typed]): untyped = | ||
result = newLit($x[0].kind) | ||
|
||
macro typedSingle(x: typed): untyped = | ||
result = newLit($x.kind) | ||
|
||
doAssert typedSingle(len) == "nnkClosedSymChoice" | ||
doAssert typedVarargs(len) == "nnkClosedSymChoice" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
block: # issue #18314 | ||
type | ||
A = ref object of RootObj | ||
B = ref object of A | ||
C = ref object of B | ||
|
||
proc foo[T: A](a: T): string = "got A" | ||
proc foo[T: B](b: T): string = "got B" | ||
|
||
var c = C() | ||
doAssert foo(c) == "got B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import std/options | ||
|
||
type | ||
Address* = object | ||
port*: int | ||
|
||
Node* = ref object | ||
address*: Option[Address] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# issue #22126 | ||
|
||
func foo[T](arr: openArray[T], idx: Natural = arr.high): int = # missed conversion: `Natural(arr.high)` | ||
if idx == 0: | ||
return 0 | ||
foo(arr, idx - 1) | ||
|
||
let arr = [0, 1, 2] | ||
|
||
doAssert foo(arr) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# issue #23020 | ||
|
||
proc n[T: bool](k: int | int) = | ||
#static: | ||
# doAssert T is bool | ||
# doAssert T isnot int | ||
|
||
# And runtime | ||
block: | ||
doAssert T is bool | ||
doAssert T isnot int | ||
|
||
n[int](0) #[tt.Error | ||
^ type mismatch: got <int literal(0)>]# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# issue #22820 | ||
|
||
{.push raises: [].} | ||
|
||
import | ||
"."/[msugarcrash1] | ||
|
||
import | ||
std/[options, sugar] | ||
|
||
var closestNodes: seq[Node] | ||
for cn in closestNodes: | ||
discard cn.address.map(a => a.port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# issue #22888 | ||
|
||
proc dummy*[T: SomeNumber](a: T, b: T = 2.5): T = #[tt.Error | ||
^ type mismatch: got <float64> but expected 'int']# | ||
result = a | ||
|
||
echo dummy(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
block: # issue #6013 | ||
type | ||
n16 = range[0'i16..high(int16)] | ||
SomeObj = ref object | ||
|
||
proc doSomethingMore(idOrObj: n16 or SomeObj) = | ||
discard | ||
|
||
proc doSomething(idOrObj: n16 or SomeObj) = | ||
doSomethingMore(idOrObj) # Error: type mismatch: got (int16) | ||
|
||
doSomething(0.n16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# issue #17779 | ||
|
||
{.experimental: "dotOperators".} | ||
|
||
type | ||
Flag = enum | ||
A | ||
|
||
Flags = set[Flag] | ||
|
||
template `.=`*(flags: Flags, key: Flag, val: bool) = | ||
if val: flags.incl key else: flags.excl key | ||
|
||
var flags: Flags | ||
|
||
flags.A = 123 #[tt.Error | ||
^ undeclared field: 'A=' for type tmismatch.Flags [type declared in tmismatch.nim(9, 5)]]# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ block: # issue #7889 | |
bindmeQuote() | ||
if false: | ||
bindmeTemplate() | ||
|
||
block: # issue #14894 | ||
myTemplate() |
Oops, something went wrong.