[fine] Error checking for some cases
This commit is contained in:
parent
4505996710
commit
d0b74db715
2 changed files with 33 additions and 2 deletions
24
fine/tests/expression/errors/class_errors.fine
Normal file
24
fine/tests/expression/errors/class_errors.fine
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class Point {
|
||||
x: f64;
|
||||
y: f64;
|
||||
}
|
||||
|
||||
fun test() {
|
||||
let one = new Point { x: 23 };
|
||||
let two = new Point { y: 23 };
|
||||
let three = new Point { y: 23, x: 123, z: "hello" };
|
||||
let four = new Point { y: 23, x: "what" };
|
||||
|
||||
let five = new Point { y: 23, x };
|
||||
|
||||
let x = "now";
|
||||
let six = new Point { y: 23, x };
|
||||
}
|
||||
|
||||
// @expect-errors:
|
||||
// | 7:12: missing an initializer for field y
|
||||
// | 8:12: missing an initializer for field x
|
||||
// | 9:41: class Point does not have a field named z
|
||||
// | 10:32: field x is of type f64, but this expression generates a string
|
||||
// | 12:32: cannot find value x here
|
||||
// | 15:31: field x is of type f64, but this expression generates a string
|
||||
Loading…
Add table
Add a link
Reference in a new issue