Skip to content

Revert "Normalize match type usage during implicit lookup" on 3.3.1 #18440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3180,7 +3180,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
tp
case Nil =>
val casesText = MatchTypeTrace.noMatchesText(scrut, cases)
throw MatchTypeReductionError(em"Match type reduction $casesText")
throw TypeError(em"Match type reduction $casesText")

inFrozenConstraint {
// Empty types break the basic assumption that if a scrutinee and a
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/core/TypeErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ object TypeError:
def toMessage(using Context) = msg
end TypeError

class MatchTypeReductionError(msg: Message)(using Context) extends TypeError:
def toMessage(using Context) = msg

class MalformedType(pre: Type, denot: Denotation, absMembers: Set[Name])(using Context) extends TypeError:
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(", ")}"

Expand Down
7 changes: 0 additions & 7 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,6 @@ trait ImplicitRunInfo:
case t: TypeLambda =>
for p <- t.paramRefs do partSeen += p
traverseChildren(t)
case t: MatchType =>
traverseChildren(t)
traverse(try t.normalized catch case _: MatchTypeReductionError => t)
case MatchType.InDisguise(mt)
if !t.isInstanceOf[LazyRef] // skip recursive applications (eg. Tuple.Map)
=>
traverse(mt)
case t =>
traverseChildren(t)

Expand Down
25 changes: 0 additions & 25 deletions tests/pos/i17395.scala

This file was deleted.