Skip to content

Commit

Permalink
Instantiate for wildcards in paramInstances
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Mar 30, 2023
1 parent 8745348 commit f331bcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
def paramInstances(canApprox: Boolean) = new TypeAccumulator[Array[Type]]:
def apply(insts: Array[Type], t: Type) = t match
case param @ TypeParamRef(b, n) if b eq caseLambda =>
def range1(tp: Type) = if variance == 0 then tp else Range(tp, tp)
def range1(tp: Type) = if variance == 0 || param.paramName.is(NameKinds.WildcardParamName) then tp else Range(tp, tp)
insts(n) =
if canApprox then
approximation(param, fromBelow = variance >= 0, Int.MaxValue).simplified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CustomCompletionTests extends DottyTest:
initialCtx.fresh
.addMode(Mode.ReadPositions | Mode.Interactive)
// discard errors - comment out this line to print them in the console
.setReporter(new StoreReporter(dotc.reporting.Reporter.NoReporter))
.setReporter(new StoreReporter(null))
.setSetting(initialCtx.settings.YstopAfter, List("typer"))
)
val file = SourceFile.virtual("<completions>", allCode, maybeIncomplete = true)
Expand Down
15 changes: 6 additions & 9 deletions tests/neg/i11982a.check
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
|
| trying to reduce Tuple.Tail[X]
| failed since selector X
| does not uniquely determine parameters _, xs in
| does not uniquely determine parameter xs in
| case _ *: xs => xs
| The computed bounds for the parameters are:
| _ >: Any
| The computed bounds for the parameter are:
| xs >: Any *: EmptyTuple.type <: Tuple
|
| longer explanation available when compiling with `-explain`
Expand All @@ -23,10 +22,9 @@
|
| trying to reduce Tuple.Tail[X]
| failed since selector X
| does not uniquely determine parameters _, xs in
| does not uniquely determine parameter xs in
| case _ *: xs => xs
| The computed bounds for the parameters are:
| _ >: Any
| The computed bounds for the parameter are:
| xs >: Any *: EmptyTuple.type <: Tuple
|
| longer explanation available when compiling with `-explain`
Expand All @@ -39,10 +37,9 @@
|
| trying to reduce Tuple.Tail[X]
| failed since selector X
| does not uniquely determine parameters _, xs in
| does not uniquely determine parameter xs in
| case _ *: xs => xs
| The computed bounds for the parameters are:
| _ >: Any
| The computed bounds for the parameter are:
| xs >: Any *: EmptyTuple.type <: Tuple
|
| longer explanation available when compiling with `-explain`

0 comments on commit f331bcb

Please sign in to comment.