Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version=$1
scala212=2.12.20
scala213=2.13.16
scala3LTS=3.3.6
scala3Next=3.7.1
scala3Next=3.7.2

cs resolve \
ch.epfl.scala:scalafix-interfaces:$version \
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Dependencies {
val scala33 = "3.3.6"
val scala35 = "3.5.2"
val scala36 = "3.6.4"
val scala37 = "3.7.1"
val scala37 = "3.7.2"
val scala3LTS = scala33
val scala3Next = sys.props.getOrElse("scala3.nightly", scala37)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FTR, this is an exact copy of the scala-2 and scala-3lts file - it's unfortunate but having it DRyed in scala or scala-3 would trigger a failure for non-LTS, non-next version for which we have nowhere to define an output file (since we scala-3lts and scala-3next are different, we can't have one in scala-3)

rules = ExplicitResultTypes
*/
package test.explicitResultTypes

object EnumerationValue {
object Day extends Enumeration {
type Day = Value
val Weekday, Weekend = Value
}
object Bool extends Enumeration {
type Bool = Value
val True, False = Value
}
import Bool._
def day(d: Day.Value): Unit = ???
val d =
if (true) Day.Weekday
else Day.Weekend
day(d)
val b =
if (true) True
else False
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package test.explicitResultTypes

object EnumerationValue {
object Day extends Enumeration {
type Day = Value
val Weekday, Weekend = Value
}
object Bool extends Enumeration {
type Bool = Value
val True, False = Value
}
import Bool._
def day(d: Day.Value): Unit = ???
val d: test.explicitResultTypes.EnumerationValue.Day.Value =
Copy link
Collaborator Author

@bjaglin bjaglin Aug 18, 2025

Choose a reason for hiding this comment

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

Follow-up of https://github.com/scalacenter/scalafix/pull/2227/files#r2076245745

scala/scala3#23124 brings

  • valid type annotations for 3.7.x target back (regression from 3.7.0 to 3.7.1)
  • consideration of the import Bool._ above for shortening, an improvement over 3.7.0 & 3.3.x which always used the FQDN as documented in
    import Bool._
    def day(d: Day.Value): Unit = ???
    val d: test.explicitResultTypes.EnumerationValue.Day.Value =
    if (true) Day.Weekday
    else Day.Weekend
    day(d)
    val b: test.explicitResultTypes.EnumerationValue.Bool.Value =
    if (true) True
    else False

if (true) Day.Weekday
else Day.Weekend
day(d)
val b: Value =
if (true) True
else False
}
Loading