Skip to content

Commit f331bcb

Browse files
committed
Instantiate for wildcards in paramInstances
1 parent 8745348 commit f331bcb

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3095,7 +3095,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
30953095
def paramInstances(canApprox: Boolean) = new TypeAccumulator[Array[Type]]:
30963096
def apply(insts: Array[Type], t: Type) = t match
30973097
case param @ TypeParamRef(b, n) if b eq caseLambda =>
3098-
def range1(tp: Type) = if variance == 0 then tp else Range(tp, tp)
3098+
def range1(tp: Type) = if variance == 0 || param.paramName.is(NameKinds.WildcardParamName) then tp else Range(tp, tp)
30993099
insts(n) =
31003100
if canApprox then
31013101
approximation(param, fromBelow = variance >= 0, Int.MaxValue).simplified

compiler/test/dotty/tools/dotc/interactive/CustomCompletionTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CustomCompletionTests extends DottyTest:
3636
initialCtx.fresh
3737
.addMode(Mode.ReadPositions | Mode.Interactive)
3838
// discard errors - comment out this line to print them in the console
39-
.setReporter(new StoreReporter(dotc.reporting.Reporter.NoReporter))
39+
.setReporter(new StoreReporter(null))
4040
.setSetting(initialCtx.settings.YstopAfter, List("typer"))
4141
)
4242
val file = SourceFile.virtual("<completions>", allCode, maybeIncomplete = true)

tests/neg/i11982a.check

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
|
88
| trying to reduce Tuple.Tail[X]
99
| failed since selector X
10-
| does not uniquely determine parameters _, xs in
10+
| does not uniquely determine parameter xs in
1111
| case _ *: xs => xs
12-
| The computed bounds for the parameters are:
13-
| _ >: Any
12+
| The computed bounds for the parameter are:
1413
| xs >: Any *: EmptyTuple.type <: Tuple
1514
|
1615
| longer explanation available when compiling with `-explain`
@@ -23,10 +22,9 @@
2322
|
2423
| trying to reduce Tuple.Tail[X]
2524
| failed since selector X
26-
| does not uniquely determine parameters _, xs in
25+
| does not uniquely determine parameter xs in
2726
| case _ *: xs => xs
28-
| The computed bounds for the parameters are:
29-
| _ >: Any
27+
| The computed bounds for the parameter are:
3028
| xs >: Any *: EmptyTuple.type <: Tuple
3129
|
3230
| longer explanation available when compiling with `-explain`
@@ -39,10 +37,9 @@
3937
|
4038
| trying to reduce Tuple.Tail[X]
4139
| failed since selector X
42-
| does not uniquely determine parameters _, xs in
40+
| does not uniquely determine parameter xs in
4341
| case _ *: xs => xs
44-
| The computed bounds for the parameters are:
45-
| _ >: Any
42+
| The computed bounds for the parameter are:
4643
| xs >: Any *: EmptyTuple.type <: Tuple
4744
|
4845
| longer explanation available when compiling with `-explain`

0 commit comments

Comments
 (0)