different error messages for same incorrect code
richardmembarth opened this issue · 1 comments
richardmembarth commented
Depending on the order of function declarations, impala emits correct error messages or segfaults.
Correct error message:
fn a(a: i32) -> () { }
fn b() -> () { }
fn main() -> () {
a(b)
}
test.impala:4 col 7 - 8: error: mismatched types: expected 'i32' but found 'fn(fn())' as argument type
Segfault:
fn a(a: i32) -> () { }
fn main() -> () {
a(b)
}
fn b() -> () { }
Assertion failed: ((!r || dynamic_cast<L*>(r)) && "cast not possible"), function scast, file thorin/src/thorin/util/cast.h, line 26.
Abort trap: 6
In both cases, the error message should be returned.
richardmembarth commented
Same problem with the following code:
struct S {
i: i16
}
fn main(s: S) -> i32 {
if s.i > 0 { 42 } else { 23 }
}
Types (Segfault in Codegen):
fn main(s: S) -> i32 {
if s.i > 0 { 42 } else { 23 }
}
struct S {
i: i16
}