v: fix build and failing tests on arm64 (#12840)

pull/12841/head
spaceface 2021-12-15 08:00:38 +01:00 committed by GitHub
parent 1c629f4a93
commit d13fe7843c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -131,7 +131,15 @@ const (
'do_not_remove',
]
skip_on_non_amd64 = [
'vlib/v/tests/closure_test.v' /* not implemented yet */,
// closures aren't implemented yet:
'vlib/v/tests/closure_test.v',
'vlib/context/cancel_test.v',
'vlib/context/deadline_test.v',
'vlib/context/empty_test.v',
'vlib/context/value_test.v',
'vlib/context/onecontext/onecontext_test.v',
'vlib/sync/once_test.v',
'vlib/sync/many_times_test.v',
'do_not_remove',
]
)

View File

@ -131,7 +131,12 @@ fn test_bin() {
x5 := byte(0b11111111)
assert x5 == 255
x6 := char(0b11111111)
assert int(x6) == -1
// C.char is unsigned on arm64, but signed on amd64, by default
$if arm64 {
assert int(x6) == 255
} $else {
assert int(x6) == -1
}
x7 := 0b0
assert x7 == 0
x8 := -0b0

View File

@ -142,7 +142,8 @@ fn test_complex_angle() {
c = cmplx.complex(-1, -1)
assert c.angle() * 180 / math.pi == -135
cc := c.conjugate()
assert cc.angle() + c.angle() == 0
a := cc.angle()
assert a + c.angle() == 0
}
fn test_complex_addinv() {

View File

@ -287,7 +287,8 @@ pub fn (mut t Transformer) check_safe_array(mut node ast.IndexExpr) {
name := node.left
match index {
ast.IntegerLiteral {
node.is_direct = t.index.safe_access(name.str(), index.val.int())
is_direct := t.index.safe_access(name.str(), index.val.int())
node.is_direct = is_direct
}
ast.RangeExpr {
if index.has_high {