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

Rework compile time error message for scala 3 #145

Merged
merged 1 commit into from
Nov 3, 2024
Merged

Conversation

jodersky
Copy link
Member

@jodersky jodersky commented Nov 2, 2024

This includes more information in the error message that is generated when a route declaration has an invalid return type.

It notably also includes the source position, as discussed in #141.

build.sc Outdated
@@ -33,7 +33,7 @@ import de.tobiasroeser.mill.vcs.version.VcsVersion

val scala213 = "2.13.10"
val scala212 = "2.12.17"
val scala3 = "3.2.2"
val scala3 = "3.3.3"
Copy link
Member Author

@jodersky jodersky Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this update is exactly needed.

I ran into a seemingly unrelated error:

[error] error while loading TimeUnit,
[error] class file /modules/java.base/java/util/concurrent/TimeUnit.class is broken, reading aborted with class java.lang.RuntimeException
[error] bad constant pool index: 0 at pos: 3355

which is likely due to me building on a machine with JDK >= 21.

In any case, I think we can bump this since Scala 3.3.x is an LTS anyway.

This includes more information in the error message that is generated when a route declaration has an invalid return type.
initialize()
}
""").msg ==>
"error in route definition `def hello` (at tasty-reflect:4:15): the method's return type scala.Tuple2[scala.Int, scala.Int] cannot be converted to the expected response type cask.model.Response[cask.model.Response.Data]"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the position "tasty-reflect:4:15" is synthetic in this test. I manually verified that the error position is correct on an actual cask project.

@jodersky jodersky requested a review from lolgab November 2, 2024 16:45
@jodersky jodersky merged commit 3200adf into master Nov 3, 2024
5 checks passed
@lolgab lolgab deleted the jo/error-message branch November 3, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants