[fine] Assignments!
And new error capabilities!
This commit is contained in:
parent
92cf840766
commit
f20f5a5e03
12 changed files with 400 additions and 64 deletions
20
fine/tests/expression/errors/assignment_errors.fine
Normal file
20
fine/tests/expression/errors/assignment_errors.fine
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
fun something() { }
|
||||
fun something_else() { }
|
||||
|
||||
fun wrong() {
|
||||
let x = 12;
|
||||
let y = "hello";
|
||||
x = y; // should be an error
|
||||
y = x; // should be an error
|
||||
|
||||
let z = 23;
|
||||
y = x = z; // should be an error
|
||||
|
||||
something_else = something; // should be an error
|
||||
}
|
||||
|
||||
// @expect-errors:
|
||||
// | 7:4: cannot assign a value of type `string` to type `f64`
|
||||
// | 8:4: cannot assign a value of type `f64` to type `string`
|
||||
// | 11:4: cannot assign a value of type `f64` to type `string`
|
||||
// | 13:2: cannot assign a new value to a function declaration
|
||||
Loading…
Add table
Add a link
Reference in a new issue