Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: fix unwrap, when generic structs are used as arguments, in u…
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
vlib/v/tests/generics_struct_method_params_is_generics_struct_and_not_called_test.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
struct Param[T] { | ||
} | ||
|
||
struct Struct[T] { | ||
} | ||
|
||
pub fn (s Struct[T]) method[T](p Param[T]) { | ||
} | ||
|
||
fn test_main() { | ||
_ = Struct[int]{} | ||
assert true | ||
// NOTE: | ||
// Do not test call Struct.method() here, | ||
// to test unwrap of generic struct parameters when the method is not called. | ||
// test results only need to can compile. | ||
} |