-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clamp default values of parameter types to upper bound (#921)
### Summary of Changes The default value of a type parameter is now clamped to its upper bound during inference of type parameters for calls.
- Loading branch information
1 parent
35dc826
commit 76ad869
Showing
2 changed files
with
17 additions
and
7 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
10 changes: 8 additions & 2 deletions
10
...urces/typing/expressions/calls/type parameter inference/clamp to upper bound/main.sdstest
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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
package tests.typing.expressions.calls.typeParameterInference.clampToUpperBound | ||
|
||
class C1<T sub Int>(p1: T) | ||
class C1<T sub Int = String>(p1: T) | ||
|
||
@Pure fun f1<T sub Int>(p1: T) -> r1: T | ||
@Pure fun f1<T sub Int = String>(p1: T) -> r1: T | ||
|
||
pipeline myPipeline { | ||
// $TEST$ serialization C1<Int> | ||
»C1("")«; | ||
|
||
// $TEST$ serialization C1<Int> | ||
»C1()«; | ||
|
||
// $TEST$ serialization Int | ||
»f1("")«; | ||
|
||
// $TEST$ serialization Int | ||
»f1()«; | ||
} |