diff options
Diffstat (limited to 'tests/reject')
48 files changed, 0 insertions, 436 deletions
diff --git a/tests/reject/99bottles.nim b/tests/reject/99bottles.nim deleted file mode 100755 index 14904ac0f..000000000 --- a/tests/reject/99bottles.nim +++ /dev/null @@ -1 +0,0 @@ -# Test if the compiler detects invalid module names diff --git a/tests/reject/mambsym1.nim b/tests/reject/mambsym1.nim deleted file mode 100755 index cf8ac5242..000000000 --- a/tests/reject/mambsym1.nim +++ /dev/null @@ -1,10 +0,0 @@ -import mambsym2 # import TExport - -type - TExport* = enum x, y, z - TOtherEnum* = enum mDec, mInc, mAssign - -proc ha() = - var - x: TExport # no error - nil diff --git a/tests/reject/mambsym2.nim b/tests/reject/mambsym2.nim deleted file mode 100755 index eac8de6ba..000000000 --- a/tests/reject/mambsym2.nim +++ /dev/null @@ -1,3 +0,0 @@ -type - TExport* = enum a, b, c - diff --git a/tests/reject/mbind4.nim b/tests/reject/mbind4.nim deleted file mode 100755 index 53b8331cd..000000000 --- a/tests/reject/mbind4.nim +++ /dev/null @@ -1,9 +0,0 @@ -# Module A -var - lastId = 0 - -template genId*: expr = - inc(lastId) - lastId - - diff --git a/tests/reject/mnamspc1.nim b/tests/reject/mnamspc1.nim deleted file mode 100755 index da13c5f24..000000000 --- a/tests/reject/mnamspc1.nim +++ /dev/null @@ -1,2 +0,0 @@ -import mnamspc2 - diff --git a/tests/reject/mnamspc2.nim b/tests/reject/mnamspc2.nim deleted file mode 100755 index 84ef8533e..000000000 --- a/tests/reject/mnamspc2.nim +++ /dev/null @@ -1,3 +0,0 @@ -# export an identifier: -var - global*: int diff --git a/tests/reject/mopaque.nim b/tests/reject/mopaque.nim deleted file mode 100755 index b7c5180fd..000000000 --- a/tests/reject/mopaque.nim +++ /dev/null @@ -1,5 +0,0 @@ -type - TLexer* {.final.} = object - line*: int - filename*: string - buffer: cstring diff --git a/tests/reject/spec.csv b/tests/reject/spec.csv deleted file mode 100755 index a332096b2..000000000 --- a/tests/reject/spec.csv +++ /dev/null @@ -1,40 +0,0 @@ -t99bott.nim;20;constant expression expected -tadrdisc.nim;15;for a 'var' type a variable needs to be passed -tambsym.nim;6;ambiguous identifier -tambsym2.nim;4;undeclared identifier: 'CreateRGBSurface' -tambsym3.nim;6;ambiguous identifier -tatomic.nim;2;identifier expected, but found 'atomic' -tbind2.nim;7;ambiguous call -tbind4.nim;4;undeclared identifier: 'lastId' -tblock1.nim;9;undeclared identifier: 'ha' -tconstr1.nim;20;type mismatch -tillrec.nim;8;illegal recursion in type 'TIllegal' -tinc.nim;3;for a 'var' type a variable needs to be passed -tinout.nim;7;for a 'var' type a variable needs to be passed -tinvalidnewseq.nim;10;type mismatch: got (array[0..6, string], int) -tinvwhen.nim;6;invalid indentation -titer4.nim;2;iterator within for loop context expected -tmethod.nim;2;'method' needs a parameter that has an object type -tnamedparams.nim;3; Error: type mismatch: got (input: string, filename: string, line: int, col: int) -tnamspc.nim;5;undeclared identifier: 'global' -tnoop.nim;6;expression 'a()' cannot be called -tnot.nim;9;type mismatch -topaque.nim;11;undeclared field: 'buffer' -topena1.nim;4;invalid type -toverl.nim;6;attempt to redefine 'TNone' -trawstr.nim;5;closing " expected -trecinca.nim;3;recursive dependency: 'tests/reject/trecincb.nim' -trecincb.nim;4;recursive dependency: 'tests/reject/trecincb.nim' -treciter.nim;4;recursive dependency: 'myrec' -trectype.nim;20;internal error: cannot generate C type for: PA -trefs.nim;15;type mismatch -tsidee1.nim;7;'SideEffectLyer' can have side effects -tsidee4.nim;10;type mismatch -tsimtych.nim;5;type mismatch: got (bool) but expected 'string' -tstatret.nim;4;statement not allowed after -tstmtexp.nim;3;value returned by statement has to be discarded -ttempl2.nim;13;undeclared identifier: 'b' -ttypelessemptyset.nim;0;Error: internal error: invalid kind for last(tyEmpty) -tunderscores.nim;3;invalid token: _ -twrongtupleaccess.nim;4;undeclared field: 'setBLAH' -typredef.nim;2;illegal recursion in type 'Uint8' diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim deleted file mode 100755 index 4dfb11701..000000000 --- a/tests/reject/t99bott.nim +++ /dev/null @@ -1,28 +0,0 @@ -## 99 Bottles of Beer -## http://www.99-bottles-of-beer.net/ -## Nimrod version - -## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr -# 2009-11-25 -# Loosely based on my old Lua version... Updated to current official lyrics. - -proc GetBottleNumber(n: int): string = - var bs: string - if n == 0: - bs = "No more bottles" - elif n == 1: - bs = "1 bottle" - else: - bs = $n & " bottles" - return bs & " of beer" - -for bn in countdown(99, 1): - const cur = GetBottleNumber(bn) #ERROR_MSG constant expression expected - echo(cur, " on the wall, ", cur, ".") - echo("Take one down and pass it around, ", GetBottleNumber(bn-1), - " on the wall.\n") - -echo "No more bottles of beer on the wall, no more bottles of beer." -echo "Go to the store and buy some more, 99 bottles of beer on the wall." - - diff --git a/tests/reject/tadrdisc.nim b/tests/reject/tadrdisc.nim deleted file mode 100755 index a7118455f..000000000 --- a/tests/reject/tadrdisc.nim +++ /dev/null @@ -1,16 +0,0 @@ -# Test that the address of a dicriminants cannot be taken - -type - TKind = enum ka, kb, kc - TA = object - case k: TKind - of ka: x, y: int - of kb: a, b: string - of kc: c, d: float - -proc setKind(k: var TKind) = - k = kc - -var a: TA -setKind(a.k) #ERROR_MSG for a 'var' type a variable needs to be passed - diff --git a/tests/reject/tambsym.nim b/tests/reject/tambsym.nim deleted file mode 100755 index b8eae3ba3..000000000 --- a/tests/reject/tambsym.nim +++ /dev/null @@ -1,8 +0,0 @@ -# Test ambiguous symbols - -import mambsym1, mambsym2 - -var - v: TExport #ERROR_MSG ambiguous identifier - -v = y diff --git a/tests/reject/tambsym2.nim b/tests/reject/tambsym2.nim deleted file mode 100755 index 3318f3fe2..000000000 --- a/tests/reject/tambsym2.nim +++ /dev/null @@ -1,6 +0,0 @@ - -from sdl import PSurface - -discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34, - 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32) - diff --git a/tests/reject/tambsym3.nim b/tests/reject/tambsym3.nim deleted file mode 100755 index 96a5098c9..000000000 --- a/tests/reject/tambsym3.nim +++ /dev/null @@ -1,8 +0,0 @@ -# Test ambiguous symbols - -import mambsym1, times - -var - v = mDec #ERROR_MSG ambiguous identifier - -writeln(stdout, ord(v)) diff --git a/tests/reject/tatomic.nim b/tests/reject/tatomic.nim deleted file mode 100755 index 0f1b8125d..000000000 --- a/tests/reject/tatomic.nim +++ /dev/null @@ -1,5 +0,0 @@ -var - atomic: int - -echo atomic - diff --git a/tests/reject/tbind2.nim b/tests/reject/tbind2.nim deleted file mode 100755 index 41711083f..000000000 --- a/tests/reject/tbind2.nim +++ /dev/null @@ -1,10 +0,0 @@ -# Test the new ``bind`` keyword for templates - -proc p1(x: int8, y: int): int = return x + y -proc p1(x: int, y: int8): int = return x - y - -template tempBind(x, y: expr): expr = - bind p1(x, y) #ERROR_MSG ambiguous call - -echo tempBind(1'i8, 2'i8) - diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim deleted file mode 100755 index d0b5fc062..000000000 --- a/tests/reject/tbind4.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Module B -import mbind4 - -echo genId() #ERROR_MSG instantiation from here - - diff --git a/tests/reject/tblock1.nim b/tests/reject/tblock1.nim deleted file mode 100755 index 0bea7ae7f..000000000 --- a/tests/reject/tblock1.nim +++ /dev/null @@ -1,11 +0,0 @@ -# check for forward label and -# for failure when label is not declared - -proc main = - block endLess: - write(stdout, "Muaahh!\N") - break endLess - - break ha #ERROR - -main() diff --git a/tests/reject/tconstr1.nim b/tests/reject/tconstr1.nim deleted file mode 100755 index 488170350..000000000 --- a/tests/reject/tconstr1.nim +++ /dev/null @@ -1,23 +0,0 @@ -# Test array, record constructors - -type - TComplexRecord = tuple[ - s: string, - x, y: int, - z: float, - chars: set[Char]] - -proc testSem = - var - things: array [0..1, TComplexRecord] = [ - (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), - (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})] - write(stdout, things[0].x) - -const - things: array [0..1, TComplexRecord] = [ - (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), - (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR - otherThings = [ # the same - (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), - (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})] diff --git a/tests/reject/tillrec.nim b/tests/reject/tillrec.nim deleted file mode 100755 index 21ce19889..000000000 --- a/tests/reject/tillrec.nim +++ /dev/null @@ -1,10 +0,0 @@ -# test illegal recursive types - -type - TLegal {.final.} = object - x: int - kids: seq[TLegal] - - TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' - y: Int - x: array[0..3, TIllegal] diff --git a/tests/reject/tinc.nim b/tests/reject/tinc.nim deleted file mode 100755 index 26fe32a41..000000000 --- a/tests/reject/tinc.nim +++ /dev/null @@ -1,5 +0,0 @@ -var x = 0 - -inc(x+1) - - diff --git a/tests/reject/tinout.nim b/tests/reject/tinout.nim deleted file mode 100755 index b4fe2fb10..000000000 --- a/tests/reject/tinout.nim +++ /dev/null @@ -1,9 +0,0 @@ -# Test in out checking for parameters - -proc abc(x: var int) = - x = 0 - -proc b() = - abc(3) #ERROR - -b() diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim deleted file mode 100755 index ccd327284..000000000 --- a/tests/reject/tinvalidnewseq.nim +++ /dev/null @@ -1,20 +0,0 @@ -import re, strutils - -type - TURL = tuple[protocol, subdomain, domain, port: string, path: seq[string]] - -proc parseURL(url: string): TURL = - #([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)? - var pattern: string = r"([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)?" - var m: array[0..6, string] #Array with the matches - newSeq(m, 7) #ERROR - discard regexprs.match(url, re(pattern), m) - - result = (protocol: m[1], subdomain: m[2], domain: m[3] & m[4], - port: m[5], path: m[6].split('/')) - -var r: TUrl - -r = parseUrl(r"http://google.com/search?var=bleahdhsad") -echo(r.domain) - diff --git a/tests/reject/tinvwhen.nim b/tests/reject/tinvwhen.nim deleted file mode 100755 index 8dc8cbf50..000000000 --- a/tests/reject/tinvwhen.nim +++ /dev/null @@ -1,8 +0,0 @@ -# This was parsed even though it should not! - -proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".} - -proc getcwd(buf: CString, buflen: cint): CString - when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation - elif defined(windows): {.importc: "getcwd", header: "<direct.h>"} - else: {.error: "os library not ported to your OS. Please help!".} diff --git a/tests/reject/titer4.nim b/tests/reject/titer4.nim deleted file mode 100755 index 376522482..000000000 --- a/tests/reject/titer4.nim +++ /dev/null @@ -1,3 +0,0 @@ - -for x in {'a'..'z'}: #ERROR_MSG iterator within for loop context expected - nil diff --git a/tests/reject/tmethod.nim b/tests/reject/tmethod.nim deleted file mode 100644 index 101cabf25..000000000 --- a/tests/reject/tmethod.nim +++ /dev/null @@ -1,4 +0,0 @@ - -method m(i: int): int = - return 5 - diff --git a/tests/reject/tnamedparams.nim b/tests/reject/tnamedparams.nim deleted file mode 100644 index 6c59518b3..000000000 --- a/tests/reject/tnamedparams.nim +++ /dev/null @@ -1,8 +0,0 @@ -import pegs - -discard parsePeg( - input = "input", - filename = "filename", - line = 1, - col = 23) - diff --git a/tests/reject/tnamspc.nim b/tests/reject/tnamspc.nim deleted file mode 100755 index eddaacfd8..000000000 --- a/tests/reject/tnamspc.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Test17 - test correct handling of namespaces - -import mnamspc1 - -global = 9 #ERROR diff --git a/tests/reject/tnoop.nim b/tests/reject/tnoop.nim deleted file mode 100755 index d097553e8..000000000 --- a/tests/reject/tnoop.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Tests the new check in the semantic pass - -var - a: int - -a() #ERROR_MSG expression 'a()' cannot be called diff --git a/tests/reject/tnot.nim b/tests/reject/tnot.nim deleted file mode 100755 index cda551654..000000000 --- a/tests/reject/tnot.nim +++ /dev/null @@ -1,15 +0,0 @@ -# BUG: following compiles, but should not: - -proc nodeOfDegree(x: Int): bool = - result = false - -proc main = - for j in 0..2: - for i in 0..10: - if not nodeOfDegree(1) >= 0: #ERROR_MSG type mismatch - Echo "Yes" - else: - Echo "No" - -main() - diff --git a/tests/reject/topaque.nim b/tests/reject/topaque.nim deleted file mode 100755 index 7553a749e..000000000 --- a/tests/reject/topaque.nim +++ /dev/null @@ -1,11 +0,0 @@ -# Test the new opaque types - -import - mopaque - -var - L: TLexer - -L.filename = "ha" -L.line = 34 -L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer' diff --git a/tests/reject/topena1.nim b/tests/reject/topena1.nim deleted file mode 100755 index 7351edf55..000000000 --- a/tests/reject/topena1.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Tests a special bug - -var - x: ref openarray[string] #ERROR_MSG invalid type - diff --git a/tests/reject/toverl.nim b/tests/reject/toverl.nim deleted file mode 100755 index 94f251cac..000000000 --- a/tests/reject/toverl.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Test for overloading - -type - TNone {.exportc: "_NONE", final.} = object - -proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone' diff --git a/tests/reject/trawstr.nim b/tests/reject/trawstr.nim deleted file mode 100755 index 7b2db0335..000000000 --- a/tests/reject/trawstr.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Test the new raw strings: - -const - xxx = r"This is a raw string!" - yyy = "This not\" #ERROR diff --git a/tests/reject/trecinca.nim b/tests/reject/trecinca.nim deleted file mode 100755 index d78fee233..000000000 --- a/tests/reject/trecinca.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Test recursive includes - -include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim' - -echo "trecina" diff --git a/tests/reject/trecincb.nim b/tests/reject/trecincb.nim deleted file mode 100755 index 6191671a1..000000000 --- a/tests/reject/trecincb.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Test recursive includes - - -include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim' - -echo "trecinb" diff --git a/tests/reject/treciter.nim b/tests/reject/treciter.nim deleted file mode 100755 index 662239285..000000000 --- a/tests/reject/treciter.nim +++ /dev/null @@ -1,7 +0,0 @@ -# Test that an error message occurs for a recursive iterator - -iterator myrec(n: int): int = - for x in myrec(n-1): #ERROR_MSG recursive dependency: 'myrec' - yield x - -for x in myrec(10): echo x diff --git a/tests/reject/trectype.nim b/tests/reject/trectype.nim deleted file mode 100755 index a7a6f56e0..000000000 --- a/tests/reject/trectype.nim +++ /dev/null @@ -1,21 +0,0 @@ -# Test recursive type descriptions -# (mainly for the C code generator) - -type - PA = ref TA - TA = array [0..2, PA] - - PRec = ref TRec - TRec {.final.} = object - a, b: TA - - P1 = ref T1 - PB = ref TB - TB = array [0..3, P1] - T1 = array [0..6, PB] - -var - x: PA -new(x) -#ERROR_MSG internal error: cannot generate C type for: PA - diff --git a/tests/reject/trefs.nim b/tests/reject/trefs.nim deleted file mode 100755 index ab3934088..000000000 --- a/tests/reject/trefs.nim +++ /dev/null @@ -1,16 +0,0 @@ -# test for ref types (including refs to procs) - -type - TProc = proc (a, b: int): int {.stdcall.} - -proc foo(c, d: int): int {.stdcall.} = - return 0 - -proc wrongfoo(c, e: int): int {.inline.} = - return 0 - -var p: TProc -p = foo -write(stdout, "success!") -p = wrongfoo #ERROR_MSG type mismatch - diff --git a/tests/reject/tsidee1.nim b/tests/reject/tsidee1.nim deleted file mode 100755 index 3bd520680..000000000 --- a/tests/reject/tsidee1.nim +++ /dev/null @@ -1,11 +0,0 @@ - -var - global: int - -proc dontcare(x: int): int = return x + global - -proc SideEffectLyer(x, y: int): int {.noSideEffect.} = #ERROR_MSG 'SideEffectLyer' can have side effects - return x + y + dontcare(x) - -echo SideEffectLyer(1, 3) - diff --git a/tests/reject/tsidee4.nim b/tests/reject/tsidee4.nim deleted file mode 100755 index 55c474d10..000000000 --- a/tests/reject/tsidee4.nim +++ /dev/null @@ -1,10 +0,0 @@ - -var - global: int - -proc dontcare(x: int): int = return x - -proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} = - return x + y + dontcare(x) - -echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch diff --git a/tests/reject/tsimtych.nim b/tests/reject/tsimtych.nim deleted file mode 100755 index b100c62e3..000000000 --- a/tests/reject/tsimtych.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Test 2 -# Simple type checking - -var a: string -a = false #ERROR diff --git a/tests/reject/tstatret.nim b/tests/reject/tstatret.nim deleted file mode 100755 index ac93ac532..000000000 --- a/tests/reject/tstatret.nim +++ /dev/null @@ -1,5 +0,0 @@ -# no statement after return -proc main() = - return - echo("huch?") #ERROR_MSG statement not allowed after - diff --git a/tests/reject/tstmtexp.nim b/tests/reject/tstmtexp.nim deleted file mode 100755 index f4d83e83f..000000000 --- a/tests/reject/tstmtexp.nim +++ /dev/null @@ -1,3 +0,0 @@ -# Test 3 - -1+4 #ERROR_MSG value returned by statement has to be discarded diff --git a/tests/reject/ttempl2.nim b/tests/reject/ttempl2.nim deleted file mode 100755 index fba6bd0cb..000000000 --- a/tests/reject/ttempl2.nim +++ /dev/null @@ -1,14 +0,0 @@ -template declareInScope(x: expr, t: typeDesc): stmt = - var x: t - -template declareInNewScope(x: expr, t: typeDesc): stmt = - # open a new scope: - block: - var x: t - -declareInScope(a, int) -a = 42 # works, `a` is known here - -declareInNewScope(b, int) -b = 42 #ERROR_MSG undeclared identifier: 'b' - diff --git a/tests/reject/ttypelessemptyset.nim b/tests/reject/ttypelessemptyset.nim deleted file mode 100755 index a49cb8fa0..000000000 --- a/tests/reject/ttypelessemptyset.nim +++ /dev/null @@ -1,4 +0,0 @@ -var q = false -discard (if q: {} else: {}) - - diff --git a/tests/reject/tunderscores.nim b/tests/reject/tunderscores.nim deleted file mode 100755 index 459cfda30..000000000 --- a/tests/reject/tunderscores.nim +++ /dev/null @@ -1,7 +0,0 @@ -# Bug #502670 - -var ef_ = 3 #ERROR_MSG invalid token: _ -var a__b = 1 -var c___d = 2 -echo(ab, cd, ef_) - diff --git a/tests/reject/twrongtupleaccess.nim b/tests/reject/twrongtupleaccess.nim deleted file mode 100644 index f706e267c..000000000 --- a/tests/reject/twrongtupleaccess.nim +++ /dev/null @@ -1,5 +0,0 @@ -# Bugfix - -var v = (5.0, 10.0) -v.setBLAH(10) - diff --git a/tests/reject/typredef.nim b/tests/reject/typredef.nim deleted file mode 100755 index a77d91f40..000000000 --- a/tests/reject/typredef.nim +++ /dev/null @@ -1,3 +0,0 @@ -type - Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' - |