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

@unroll on a case class field without a default argument produces bad error message #22832

Open
lihaoyi opened this issue Mar 18, 2025 · 0 comments
Assignees
Labels
area:annotations area:experimental:unroll Issues tied to the @unroll annotation area:experimental area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement

Comments

@lihaoyi
Copy link
Contributor

lihaoyi commented Mar 18, 2025

Compiler version

3.7.0-RC1

Minimized example

case class Foo(@scala.annotation.unroll x: Int)

Output Error/Warning message

[44] [info] compiling 1 Scala source to /Users/lihaoyi/test/out/compile.dest/classes ...
[44] [error] value $lessinit$greater$default$1 is not a member of object Foo
[44] [error] one error found

Why this Error/Warning was not helpful

I would expect this to produce a similar error message to @unrolling a method param or normal class param that is lacking a default value

[44] [error] -- Error: /Users/lihaoyi/test/src/test.scala:1:35 ------------------------------
[44] [error] 1 |class Foo(@scala.annotation.unroll x: Int)
[44] [error]   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[44] [error]   |Cannot unroll method <init> in class Foo at line 1 because parameter x needs a default value
@lihaoyi lihaoyi added area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 18, 2025
@Gedochao Gedochao added area:annotations area:experimental and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 18, 2025
@Gedochao Gedochao added the area:experimental:unroll Issues tied to the @unroll annotation label Mar 18, 2025
@hamzaremmal hamzaremmal self-assigned this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:annotations area:experimental:unroll Issues tied to the @unroll annotation area:experimental area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Projects
None yet
Development

No branches or pull requests

3 participants