-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add better error reporting for inlined non-immutable paths (#21639)
Fixes #21538
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
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
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,11 @@ | ||
-- [E083] Type Error: tests/neg/21538.scala:3:45 ----------------------------------------------------------------------- | ||
3 |inline def foo[V](inline value: V)(using Bar[value.type]) : Unit = {} // error | ||
| ^^^^^^^^^^ | ||
| (value : V) is not a valid singleton type, since it is not an immutable path | ||
| Inline parameters are not considered immutable paths and cannot be used as | ||
| singleton types. | ||
| | ||
| Hint: Removing the `inline` qualifier from the `value` parameter | ||
| may help resolve this issue. | ||
| | ||
| longer explanation available when compiling with `-explain` |
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,3 @@ | ||
trait Bar[T] | ||
given [T]: Bar[T] with {} | ||
inline def foo[V](inline value: V)(using Bar[value.type]) : Unit = {} // error |