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

Wrong pattern must be a value #3063

Closed
tgodzik opened this issue Jan 25, 2023 · 7 comments · Fixed by #3270
Closed

Wrong pattern must be a value #3063

tgodzik opened this issue Jan 25, 2023 · 7 comments · Fixed by #3270

Comments

@tgodzik
Copy link
Collaborator

tgodzik commented Jan 25, 2023

Found an issue when working on scalameta/metals#4896

${ success.tree.asExprOf[InterpolationConverterType] }

looks like an issue with Scala 3 dialect

@tgodzik tgodzik changed the title Wrong pattern must be a valuescalameta Wrong pattern must be a value Jan 25, 2023
@kitbellew
Copy link
Collaborator

@tgodzik can you repro? I added to MacroSuite.scala

    runTestAssert[Stat](
      "${ success.tree.asExprOf[InterpolationConverterType] }"
    )(
      ...
    )

and it didn't have any parsing problems.

@Atry
Copy link

Atry commented Jan 26, 2023

@tgodzik
Copy link
Collaborator Author

tgodzik commented Jan 26, 2023

@tgodzik can you repro? I added to MacroSuite.scala

    runTestAssert[Stat](
      "${ success.tree.asExprOf[InterpolationConverterType] }"
    )(
      ...
    )

and it didn't have any parsing problems.

I wanted to take a look, but I didn't have time yet. @Atry is right, it fails there.

@i10416 i10416 mentioned this issue Apr 13, 2023
7 tasks
@sirthias
Copy link

I tripped over this same issue in https://github.com/sirthias/borer.
A parser bug is a real pain since it completely kills the build and cannot be fenced off // format: OFF.
For now I had to completely exclude the affected files with project.excludePaths = [ ... ].

@kitbellew
Copy link
Collaborator

kitbellew commented Apr 25, 2023

I tripped over this same issue in https://github.com/sirthias/borer. A parser bug is a real pain since it completely kills the build and cannot be fenced off // format: OFF. For now I had to completely exclude the affected files with project.excludePaths = [ ... ].

can you please provide a small reproducible example? we haven't made progress on this because the original example does not fail in our tests.

@sirthias
Copy link

It's a weird issue, also for me.
It only happened on complete, clean rebuilds, not on subsequent runs.
I'll try once more to isolate it.

sirthias added a commit to sirthias/borer that referenced this issue Apr 25, 2023
@kitbellew
Copy link
Collaborator

@tgodzik @sirthias @Atry can you provide the link to a failing file and the line number in that file? Whether on clean builds or every time, doesn't matter.

pattern must be a value appears in the parser code only once, when parsing an expression like this:

foo match
  case bar[baz] => // parser expects parentheses after brackets

(or any other pattern expression which looks like bar[baz], such as in for { pattern <- ... }). So, need to know not only the exact expression but its full context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants