Skip to content
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

Type desugared transparent inline def unapply call in the correct mode #20108

Merged
merged 1 commit into from
Apr 9, 2024
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
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,8 @@ trait Applications extends Compatibility {
report.error(em"Structural unapply is not supported", unapplyFn.srcPos)
(unapplyFn, unapplyAppCall)
case Apply(fn, `dummyArg` :: Nil) =>
val inlinedUnapplyFn = Inlines.inlinedUnapplyFun(fn)
val inlinedUnapplyFn = withoutMode(Mode.Pattern):
Inlines.inlinedUnapplyFun(fn)
(inlinedUnapplyFn, inlinedUnapplyFn.appliedToArgs(`dummyArg` :: Nil))
case Apply(fn, args) =>
val (fn1, app) = rec(fn)
Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i20107.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object foo:
transparent inline def unapply[F](e: F): Option[F] = Some(e.asInstanceOf[F])

class A:
def test(x: Int) = x match
case foo(e) => e
Loading