Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
smarter committed Apr 4, 2024
1 parent a7f00e2 commit c394171
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 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,7 @@ 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 = Inlines.inlinedUnapplyFun(fn)(using ctx.retractMode(Mode.Pattern))
(inlinedUnapplyFn, inlinedUnapplyFn.appliedToArgs(`dummyArg` :: Nil))
case Apply(fn, args) =>
val (fn1, app) = rec(fn)
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/asofa.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object asOfA:
transparent inline def unapply[F](e: Any): Option[Any] = Some(e.asInstanceOf[F])

class A:
def test(x: Int) = x match
case asOfA[Int](e) => e


0 comments on commit c394171

Please sign in to comment.