-
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.
Fix ignored type variable bound warning in type quote pattern (#18199)
See the diff in tests/neg-macros/quote-type-variable-no-inference.check
- Loading branch information
Showing
11 changed files
with
103 additions
and
30 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
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
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
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,13 @@ | ||
-- Warning: tests/neg-macros/quote-type-variable-no-inference-2.scala:5:22 --------------------------------------------- | ||
5 | case '{ $_ : F[t, t]; () } => // warn // error | ||
| ^ | ||
| Ignored bound <: Double | ||
| | ||
| Consider defining bounds explicitly: | ||
| '{ type t <: Int & Double; ... } | ||
-- [E057] Type Mismatch Error: tests/neg-macros/quote-type-variable-no-inference-2.scala:5:12 -------------------------- | ||
5 | case '{ $_ : F[t, t]; () } => // warn // error | ||
| ^ | ||
| Type argument t does not conform to upper bound Double in inferred type F[t, t] | ||
| | ||
| 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,8 @@ | ||
import scala.quoted.* | ||
|
||
def test2(x: Expr[Any])(using Quotes) = | ||
x match | ||
case '{ $_ : F[t, t]; () } => // warn // error | ||
case '{ type u <: Int & Double; $_ : F[u, u] } => | ||
|
||
type F[X <: Int, Y <: Double] |
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,20 @@ | ||
-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:5:22 --------------------------------------------- | ||
5 | case '{ $_ : F[t, t]; () } => // warn // error | ||
| ^ | ||
| Ignored bound <: Comparable[U] | ||
| | ||
| Consider defining bounds explicitly: | ||
| '{ type t <: Comparable[U]; ... } | ||
-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:6:49 --------------------------------------------- | ||
6 | case '{ type u <: Comparable[`u`]; $_ : F[u, u] } => | ||
| ^ | ||
| Ignored bound <: Comparable[Any] | ||
| | ||
| Consider defining bounds explicitly: | ||
| '{ type u <: Comparable[u] & Comparable[Any]; ... } | ||
-- [E057] Type Mismatch Error: tests/neg-macros/quote-type-variable-no-inference-3.scala:5:12 -------------------------- | ||
5 | case '{ $_ : F[t, t]; () } => // warn // error | ||
| ^ | ||
| Type argument t does not conform to upper bound Comparable[t] in inferred type F[t, t] | ||
| | ||
| 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,8 @@ | ||
import scala.quoted.* | ||
|
||
def test2(x: Expr[Any])(using Quotes) = | ||
x match | ||
case '{ $_ : F[t, t]; () } => // warn // error | ||
case '{ type u <: Comparable[`u`]; $_ : F[u, u] } => | ||
|
||
type F[T, U <: Comparable[U]] |
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