Skip to content

Commit ac2c884

Browse files
authored
Revert "Normalize match type usage during implicit lookup" on 3.3.1 (#18440)
Reverts #17457. This fix caused significant challenges in maintaining the source compatibility. We decided not to include it in 3.3.1. It will still be a part of 3.4 and future Scala Next versions. It is possible that in the future, an improved version of this fix will make it to one of 3.3.x releases.
2 parents eb0ce8f + 6bf8ac9 commit ac2c884

File tree

4 files changed

+1
-36
lines changed

4 files changed

+1
-36
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3180,7 +3180,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
31803180
tp
31813181
case Nil =>
31823182
val casesText = MatchTypeTrace.noMatchesText(scrut, cases)
3183-
throw MatchTypeReductionError(em"Match type reduction $casesText")
3183+
throw TypeError(em"Match type reduction $casesText")
31843184

31853185
inFrozenConstraint {
31863186
// Empty types break the basic assumption that if a scrutinee and a

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ object TypeError:
4646
def toMessage(using Context) = msg
4747
end TypeError
4848

49-
class MatchTypeReductionError(msg: Message)(using Context) extends TypeError:
50-
def toMessage(using Context) = msg
51-
5249
class MalformedType(pre: Type, denot: Denotation, absMembers: Set[Name])(using Context) extends TypeError:
5350
def toMessage(using Context) = em"malformed type: $pre is not a legal prefix for $denot because it contains abstract type member${if (absMembers.size == 1) "" else "s"} ${absMembers.mkString(", ")}"
5451

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,6 @@ trait ImplicitRunInfo:
636636
case t: TypeLambda =>
637637
for p <- t.paramRefs do partSeen += p
638638
traverseChildren(t)
639-
case t: MatchType =>
640-
traverseChildren(t)
641-
traverse(try t.normalized catch case _: MatchTypeReductionError => t)
642-
case MatchType.InDisguise(mt)
643-
if !t.isInstanceOf[LazyRef] // skip recursive applications (eg. Tuple.Map)
644-
=>
645-
traverse(mt)
646639
case t =>
647640
traverseChildren(t)
648641

tests/pos/i17395.scala

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)