Skip to content

Regression in 3.4.1: spurious error when using transparent inline def unapply #20107

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

Closed
smarter opened this issue Apr 5, 2024 · 0 comments · Fixed by #20108
Closed

Regression in 3.4.1: spurious error when using transparent inline def unapply #20107

smarter opened this issue Apr 5, 2024 · 0 comments · Fixed by #20108
Assignees
Labels
area:inline area:pattern-matching itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@smarter
Copy link
Member

smarter commented Apr 5, 2024

Compiler version

3.4.1 (Worked in 3.3, 3.4.0, broke in #19380)

Minimized code

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

Output

```-- Error: foo.scala:6:9 --------------------------------------------
6 |    case foo(e) => e
  |         ^^^
  |         invalid pattern
  |-----------------------------------------------------------------------------
  |Inline stack trace
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |This location contains code that was inlined from foo.scala:2
2 |     transparent inline def unapply[F](e: F): Option[F] = Some(e.asInstanceOf[F])
  |                                                               ^^^^^^^^^^^^^^^^^
   -----------------------------------------------------------------------------
-- [E107] Syntax Error: foo.scala:6:12 -----------------------------
6 |    case foo(e) => e
  |         ^^^^^^
  |         Wrong number of argument patterns for foo; expected: ()
  |
  | longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: foo.scala:6:19 --------------------------
6 |    case foo(e) => e
  |                   ^
  |                   Not found: e
  |
  | longer explanation available when compiling with `-explain`

Expectation

This should work as it used to before #19380 (it still works without transparent).

@smarter smarter added itype:bug area:pattern-matching area:inline regression This worked in a previous version but doesn't anymore labels Apr 5, 2024
@smarter smarter self-assigned this Apr 5, 2024
smarter added a commit to dotty-staging/dotty that referenced this issue Apr 5, 2024
nicolasstucki added a commit that referenced this issue Apr 9, 2024
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur pushed a commit that referenced this issue Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:inline area:pattern-matching itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants