-
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 incorrect caching with dependent method parameters (#21699)
The added test case used to fail Ycheck:typer with the seemingly identicals: Found: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})] Required: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})] In fact one of the `aa` is a a TypeVar instantiated to `A {type B = Int }`. The MethodType comparison failed the signature check because the `a.B` where `a` is backed by a type variable had a stale signature cached. Fixed by changing `isProvisional` to traverse ParamRefs.
- Loading branch information
Showing
4 changed files
with
29 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
-- Error: tests/neg/i16842.scala:24:7 ---------------------------------------------------------------------------------- | ||
24 | Liter(SemanticArray[SemanticInt.type], x) // error | ||
| ^ | ||
| invalid new prefix (dim: Int): SemanticArray[SemanticInt.type] cannot replace ty.type in type ty.T | ||
-- [E007] Type Mismatch Error: tests/neg/i16842.scala:24:8 ------------------------------------------------------------- | ||
24 | Liter(SemanticArray[SemanticInt.type], x) // error // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Found: Int => SemanticArray[SemanticInt.type] | ||
| Required: SemanticArray[SemanticType] | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg/i16842.scala:24:41 ------------------------------------------------------------ | ||
24 | Liter(SemanticArray[SemanticInt.type], x) // error // error | ||
| ^ | ||
| Found: (x : List[Expr2[SemanticInt.type]]) | ||
| Required: ty.T | ||
| Note that implicit conversions were not tried because the result of an implicit conversion | ||
| must be more specific than ty.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
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,9 @@ | ||
trait A: | ||
type B | ||
|
||
class CCPoly[T <: A](a: T, b: a.B) | ||
|
||
object Test: | ||
def test(): Unit = | ||
val aa: A { type B = Int } = new A { type B = Int } | ||
val x: CCPoly[aa.type] = CCPoly(aa, 1) |