Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different error messages for same incorrect code #44

Closed
richardmembarth opened this issue Jan 10, 2017 · 1 comment
Closed

different error messages for same incorrect code #44

richardmembarth opened this issue Jan 10, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@richardmembarth
Copy link
Member

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
Copy link
Member Author

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 
}

leissa added a commit that referenced this issue Jan 12, 2017
@leissa leissa closed this as completed Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants