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 {
13251325 x : i64 ,
13261326 y : i64 ,
13271327 }
1328+ impl Default for Vec2 {
1329+ fn default ( ) -> Self {
1330+ Vec2 { x : 0 , y : 0 }
1331+ }
1332+ }
13281333 // Implement all overloadable operators for Vec2
13291334 impl Add for Vec2 {
13301335 type Output = Self ;
@@ -1671,6 +1676,10 @@ mod overloadable_operators {
16711676 // Prefix operators
16721677 let vec2_neg = -v1; // $ type=vec2_neg:Vec2 method=Vec2::neg
16731678 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
16741683 }
16751684}
16761685
You can’t perform that action at this time.
0 commit comments