File tree Expand file tree Collapse file tree 2 files changed +956
-934
lines changed
rust/ql/test/library-tests/type-inference Expand file tree Collapse file tree 2 files changed +956
-934
lines changed Original file line number Diff line number Diff line change @@ -1325,6 +1325,11 @@ mod overloadable_operators {
1325
1325
x : i64 ,
1326
1326
y : i64 ,
1327
1327
}
1328
+ impl Default for Vec2 {
1329
+ fn default ( ) -> Self {
1330
+ Vec2 { x : 0 , y : 0 }
1331
+ }
1332
+ }
1328
1333
// Implement all overloadable operators for Vec2
1329
1334
impl Add for Vec2 {
1330
1335
type Output = Self ;
@@ -1671,6 +1676,10 @@ mod overloadable_operators {
1671
1676
// Prefix operators
1672
1677
let vec2_neg = -v1; // $ type=vec2_neg:Vec2 method=Vec2::neg
1673
1678
let vec2_not = !v1; // $ type=vec2_not:Vec2 method=Vec2::not
1679
+
1680
+ // Here the type of `default_vec2` must be inferred from the `+` call.
1681
+ let default_vec2 = Default :: default ( ) ; // $ MISSING: type=default_vec2:Vec2
1682
+ let vec2_zero_plus = Vec2 { x : 0 , y : 0 } + default_vec2; // $ method=Vec2::add
1674
1683
}
1675
1684
}
1676
1685
You can’t perform that action at this time.
0 commit comments