Skip to content

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented Apr 14, 2025

No description provided.

@bjaglin bjaglin changed the title build and test against 3.7.1 (placeholder) build and test against scala 3.7.1 (placeholder) Apr 14, 2025
@bjaglin bjaglin changed the title build and test against scala 3.7.1 (placeholder) build and test against scala 3.7.1 (WIP RC1) May 6, 2025
@bjaglin bjaglin force-pushed the scala371 branch 2 times, most recently from a8674bd to aa48bde Compare May 6, 2025 20:35
Comment on lines +17 to +23
val d =
if (true) Day.Weekday
else Day.Weekend
day(d)
val b =
if (true) True
else False
Copy link
Collaborator Author

@bjaglin bjaglin May 6, 2025

Choose a reason for hiding this comment

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

The test infrastructure is not great to represent the intent of that change, but this was copied in order to skip scala3-next.

That's because the 3.7.1-RC1 PC is trying to be smarter when shortening types but gets fooled by the import Bool. somehow , and we end up with that code that does not compile

Suggested change
val d =
if (true) Day.Weekday
else Day.Weekend
day(d)
val b =
if (true) True
else False
val d: Value =
if (true) Day.Weekday
else Day.Weekend
day(d)
val b: Value =
if (true) True
else False
[error] -- [E007] Type Mismatch Error: /Users/brice.jaglin/git/scala/scalafix/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/EnumerationValue.scala:15:18
[error] 15 |    if (true) Day.Weekday
[error]    |              ^^^^^^^^^^^
[error]    |      Found:    (test.explicitResultTypes.EnumerationValue.Day.Weekday :
[error]    |        test.explicitResultTypes.EnumerationValue.Day.Value)
[error]    |      Required: test.explicitResultTypes.EnumerationValue.Bool.Value
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/brice.jaglin/git/scala/scalafix/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/EnumerationValue.scala:16:13
[error] 16 |    else Day.Weekend
[error]    |         ^^^^^^^^^^^
[error]    |      Found:    (test.explicitResultTypes.EnumerationValue.Day.Weekend :
[error]    |        test.explicitResultTypes.EnumerationValue.Day.Value)
[error]    |      Required: test.explicitResultTypes.EnumerationValue.Bool.Value
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/brice.jaglin/git/scala/scalafix/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/EnumerationValue.scala:17:6
[error] 17 |  day(d)
[error]    |      ^
[error]    |      Found:    (test.explicitResultTypes.EnumerationValue.d :
[error]    |        test.explicitResultTypes.EnumerationValue.Bool.Value)
[error]    |      Required: test.explicitResultTypes.EnumerationValue.Day.Value
[error]    |
[error]    | longer explanation available when compiling with `-explain`

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just went through the recent changes of the PC and scala/scala3#22898 might be a candidate for the regression.

@tgodzik since you are the author, maybe you can confirm/infirm? I will end up filing an issue upstream eventually, but my knowledge of the dotty repo is limited so it will take me a while to write a unit test :)

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be some side effect of that PR yeah. It was a tricky part of the compiler. If you could just put the example in a issue I will take a look.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ach, I think I know what is going on. Those are path dependent types and it's not handled at all properly :/

Copy link
Contributor

Choose a reason for hiding this comment

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

I've got something working, but I broke another test:
https://github.com/scala/scala3/compare/main...tgodzik:scala3:fix-path-dep?expand=1

I am not sure how to differentiate types that are actually in Scope from those that are not if they actually have the same symbol.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, let's try get scala/scala3#23124 merged, took me longer than expected

Copy link
Collaborator Author

@bjaglin bjaglin Jun 4, 2025

Choose a reason for hiding this comment

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

Thanks! Taking note to simplify the test once 3.7.2-RC1 is tagged

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bjaglin bjaglin force-pushed the scala371 branch 2 times, most recently from 3423c8f to 221ddc0 Compare May 8, 2025 19:57
@bjaglin bjaglin changed the title build and test against scala 3.7.1 (WIP RC1) build and test against scala 3.7.1 (WIP RC2) Jun 1, 2025
@bjaglin bjaglin changed the title build and test against scala 3.7.1 (WIP RC2) build and test against scala 3.7.1 Jun 4, 2025
@bjaglin bjaglin marked this pull request as ready for review June 4, 2025 22:47
@bjaglin bjaglin merged commit 56c915a into scalacenter:main Jun 4, 2025
9 checks passed
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