resolved the conflict
This commit is contained in:
commit
40b379859c
29 changed files with 600 additions and 249 deletions
|
|
@ -1,31 +1,26 @@
|
|||
discard """
|
||||
output: '''obj has '==': false
|
||||
int has '==': true
|
||||
false
|
||||
true
|
||||
true
|
||||
no'''
|
||||
"""
|
||||
|
||||
# test the new 'compiles' feature:
|
||||
|
||||
template supports(opr, x: expr): bool {.immediate.} =
|
||||
compiles(opr(x)) or compiles(opr(x, x))
|
||||
|
||||
template ok(x: expr): stmt =
|
||||
static: assert(x)
|
||||
|
||||
template no(x: expr): stmt =
|
||||
static: assert(not x)
|
||||
|
||||
type
|
||||
TObj = object
|
||||
|
||||
var
|
||||
myObj {.compileTime.}: TObj
|
||||
|
||||
echo "obj has '==': ", supports(`==`, myObj)
|
||||
echo "int has '==': ", supports(`==`, 45)
|
||||
ok supports(`==`, myObj)
|
||||
ok supports(`==`, 45)
|
||||
|
||||
echo supports(`++`, 34)
|
||||
echo supports(`not`, true)
|
||||
echo supports(`+`, 34)
|
||||
no supports(`++`, 34)
|
||||
ok supports(`not`, true)
|
||||
ok supports(`+`, 34)
|
||||
|
||||
no compiles(4+5.0 * "hallo")
|
||||
|
||||
when compiles(4+5.0 * "hallo"):
|
||||
echo "yes"
|
||||
else:
|
||||
echo "no"
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ discard """
|
|||
line: 11
|
||||
errormsg: "expression \'a()\' cannot be called"
|
||||
"""
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
discard """
|
||||
file: "topaque.nim"
|
||||
line: 16
|
||||
errormsg: "undeclared field: \'buffer\'"
|
||||
errormsg: "undeclared identifier: \'buffer\'"
|
||||
"""
|
||||
# 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'
|
||||
# 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'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
discard """
|
||||
file: "twrongtupleaccess.nim"
|
||||
line: 9
|
||||
errormsg: "undeclared field: \'setBLAH\'"
|
||||
errormsg: "undeclared identifier: \'setBLAH\'"
|
||||
"""
|
||||
# Bugfix
|
||||
|
||||
var v = (5.0, 10.0)
|
||||
v.setBLAH(10)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue