parent
9b9cfa7306
commit
4d5cce9882
13 changed files with 95 additions and 12 deletions
46
tests/arithm/tashr.nim
Normal file
46
tests/arithm/tashr.nim
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
discard """
|
||||
output: ''''''
|
||||
targets: '''c js'''
|
||||
"""
|
||||
|
||||
# issue #6255, feature request
|
||||
# arithmetic right shift
|
||||
|
||||
var x1 = -123'i8
|
||||
var x2 = -123'i16
|
||||
var x3 = -123'i32
|
||||
var x4 = -123'i64
|
||||
var x5 = -123
|
||||
|
||||
block codegen_test:
|
||||
doAssert ashr(x1, 1) == -62
|
||||
doAssert ashr(x2, 1) == -62
|
||||
doAssert ashr(x3, 1) == -62
|
||||
doAssert ashr(x4, 1) == -62
|
||||
doAssert ashr(x5, 1) == -62
|
||||
|
||||
block semfold_test:
|
||||
doAssert ashr(-123'i8 , 1) == -62
|
||||
doAssert ashr(-123'i16, 1) == -62
|
||||
doAssert ashr(-123'i32, 1) == -62
|
||||
doAssert ashr(-123'i64, 1) == -62
|
||||
doAssert ashr(-123 , 1) == -62
|
||||
|
||||
static: # VM test
|
||||
doAssert ashr(-123'i8 , 1) == -62
|
||||
doAssert ashr(-123'i16, 1) == -62
|
||||
doAssert ashr(-123'i32, 1) == -62
|
||||
doAssert ashr(-123'i64, 1) == -62
|
||||
doAssert ashr(-123 , 1) == -62
|
||||
|
||||
var y1 = -123'i8
|
||||
var y2 = -123'i16
|
||||
var y3 = -123'i32
|
||||
var y4 = -123'i64
|
||||
var y5 = -123
|
||||
|
||||
doAssert ashr(y1, 1) == -62
|
||||
doAssert ashr(y2, 1) == -62
|
||||
doAssert ashr(y3, 1) == -62
|
||||
doAssert ashr(y4, 1) == -62
|
||||
doAssert ashr(y5, 1) == -62
|
||||
|
|
@ -13,18 +13,14 @@ proc add(result: var string; x: float)
|
|||
first type mismatch at position: 1
|
||||
required type: var string
|
||||
but expression 'k' is of type: Alias
|
||||
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(x: var string; y: char)
|
||||
first type mismatch at position: 1
|
||||
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(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: T)
|
||||
first type mismatch at position: 1
|
||||
required type: var seq[T]
|
||||
|
|
@ -33,6 +29,10 @@ proc add(result: var string; x: int64)
|
|||
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
|
||||
|
||||
t3330.nim(48, 8) template/generic instantiation from here
|
||||
t3330.nim(55, 6) Foo: 'bar.value' cannot be assigned to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue