0340f32748
Autoderef on binops is basically unused, kind of silly, and complicates typechecking. There were only three instances of it in the compiler and the test drivers, two of which were of the form "*foo = foo + 1", which should be written as "*foo += 1" anyways.
18 lines
408 B
Rust
18 lines
408 B
Rust
// error-pattern: binary operation + cannot be applied to type
|
|
type clam = {x: @int, y: @int};
|
|
|
|
type fish = {a: @int};
|
|
|
|
fn main() {
|
|
let a: clam = {x: @1, y: @2};
|
|
let b: clam = {x: @10, y: @20};
|
|
let z: int = a.x + b.y;
|
|
log z;
|
|
assert (z == 21);
|
|
let forty: fish = {a: @40};
|
|
let two: fish = {a: @2};
|
|
let answer: int = forty.a + two.a;
|
|
log answer;
|
|
assert (answer == 42);
|
|
}
|