Skip to content

Commit

Permalink
Upgrade to Scala 3.4.2.
Browse files Browse the repository at this point in the history
And apply changes due to
scala/scala3#19761
  • Loading branch information
sjrd committed Jul 24, 2024
1 parent 59811cb commit 3c9ff69
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sbt.internal.util.ManagedLogger

import org.scalajs.jsenv.nodejs.NodeJSEnv

val usedScalaCompiler = "3.4.0"
val usedScalaCompiler = "3.4.2"
val usedTastyRelease = usedScalaCompiler
val scala2Version = "2.13.14"

Expand Down
22 changes: 16 additions & 6 deletions tasty-query/shared/src/test/scala/tastyquery/PrintersTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
)

val MatchTypeClass = ctx.findTopLevelClass("simple_trees.MatchType")
testShowBasicMember(MatchTypeClass, typeName("MT"), "type MT[X] = X match { case Int => String }")
testShowBasicMember(
MatchTypeClass,
typeName("MT"),
"type MT[X] <: scala.Predef.String = X match { case Int => String }"
)
testShowBasicMember(
MatchTypeClass,
typeName("MTWithBound"),
Expand All @@ -220,9 +224,14 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
testShowBasicMember(
MatchTypeClass,
typeName("MTWithWildcard"),
"type MTWithWildcard[X] = X match { case _ => Int }"
"type MTWithWildcard[X] <: scala.Int = X match { case _ => Int }"
)
// The `<: t` is completely wrong. See https://github.com/scala/scala3/issues/21256
testShowBasicMember(
MatchTypeClass,
typeName("MTWithBind"),
"type MTWithBind[X] <: t = X match { case List[t] => t }"
)
testShowBasicMember(MatchTypeClass, typeName("MTWithBind"), "type MTWithBind[X] = X match { case List[t] => t }")
}

testWithContext("multiline tree printers") {
Expand Down Expand Up @@ -286,7 +295,7 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
testShowMultilineMember(
MatchTypeClass,
typeName("MT"),
"""type MT[X] = X match {
"""type MT[X] <: scala.Predef.String = X match {
| case Int => String
|}""".stripMargin
)
Expand All @@ -300,14 +309,15 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
testShowMultilineMember(
MatchTypeClass,
typeName("MTWithWildcard"),
"""type MTWithWildcard[X] = X match {
"""type MTWithWildcard[X] <: scala.Int = X match {
| case _ => Int
|}""".stripMargin
)
// The `<: t` is completely wrong. See https://github.com/scala/scala3/issues/21256
testShowMultilineMember(
MatchTypeClass,
typeName("MTWithBind"),
"""type MTWithBind[X] = X match {
"""type MTWithBind[X] <: t = X match {
| case List[t] => t
|}""".stripMargin
)
Expand Down
18 changes: 10 additions & 8 deletions tasty-query/shared/src/test/scala/tastyquery/ReadTreeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1904,8 +1904,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
TypeAliasDefinitionTree(
MatchTypeTree(
// No bound on the match result
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
// No bound on the match result -- inferred to be String since 3.4.2
TypeWrapper(TypeRefInternal(_, tpnme.String)),
TypeIdent(SimpleTypeName("X")),
List(TypeCaseDef(TypeIdent(SimpleTypeName("Int")), TypeIdent(SimpleTypeName("String"))))
)
Expand Down Expand Up @@ -1946,8 +1946,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
TypeAliasDefinitionTree(
MatchTypeTree(
// No bound on the match result
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
// No bound on the match result -- inferred since 3.4.2
TypeWrapper(_),
TypeIdent(SimpleTypeName("X")),
List(TypeCaseDef(TypeIdent(tpnme.Wildcard), TypeIdent(SimpleTypeName("Int"))))
)
Expand All @@ -1965,8 +1965,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
TypeAliasDefinitionTree(
MatchTypeTree(
// No bound on the match result
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
// No bound on the match result -- inferred since 3.4.2
TypeWrapper(_),
TypeIdent(SimpleTypeName("X")),
List(
TypeCaseDef(
Expand Down Expand Up @@ -1995,7 +1995,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
Select(rhs, SignedName(SimpleName("$asInstanceOf$"), _, _)),
TypeWrapper(
ty.MatchType(
TypeRefInternal(ScalaPackageRef(), SimpleTypeName("Any")),
// No bound on the match result -- inferred since 3.4.2
_,
TypeRefInternal(_, xRef),
List(
ty.MatchTypeCase(
Expand Down Expand Up @@ -2026,7 +2027,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
Select(rhs, SignedName(SimpleName("$asInstanceOf$"), _, _)),
TypeWrapper(
ty.MatchType(
TypeRefInternal(ScalaPackageRef(), SimpleTypeName("Any")),
// No bound on the match result -- inferred since 3.4.2
_,
TypeRefInternal(_, xRef),
List(
ty.MatchTypeCase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ class SignatureSuite extends UnrestrictedUnpicklingSuite:
val MatchType = ctx.findTopLevelClass("simple_trees.MatchType")

val unboundUnreducibleSig = MatchType.findNonOverloadedDecl(termName("unboundUnreducibleSig"))
assertSigned(unboundUnreducibleSig, "(1,java.lang.Object):java.lang.Object")
// Was "(1,java.lang.Object):java.lang.Object" < 3.4.2
assertSigned(unboundUnreducibleSig, "(1,java.lang.Object):java.lang.String")

val unboundReducibleSig = MatchType.findNonOverloadedDecl(termName("unboundReducibleSig"))
assertSigned(unboundReducibleSig, "(1,scala.Int):java.lang.String")
Expand All @@ -421,7 +422,8 @@ class SignatureSuite extends UnrestrictedUnpicklingSuite:

// this one is suspicious, but it is what dotc does (I expected `Object` instead of `Object[]`)
val arrayOfUnboundUnreducibleSig = MatchType.findNonOverloadedDecl(termName("arrayOfUnboundUnreducibleSig"))
assertSigned(arrayOfUnboundUnreducibleSig, "(1,java.lang.Object):java.lang.Object[]")
// Was "(1,java.lang.Object):java.lang.Object[]" < 3.4.2
assertSigned(arrayOfUnboundUnreducibleSig, "(1,java.lang.Object):java.lang.String[]")

val arrayOfUnboundReducibleSig = MatchType.findNonOverloadedDecl(termName("arrayOfUnboundReducibleSig"))
assertSigned(arrayOfUnboundReducibleSig, "(1,scala.Int):java.lang.String[]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package simple_trees

import scala.annotation.nowarn

@nowarn("msg=The \\[this\\] qualifier will be deprecated")
@nowarn("msg=Ignoring \\[this\\] qualifier")
class AccessModifiers(
localParam: Int,
private[this] val privateThisParam: Int,
Expand Down

0 comments on commit 3c9ff69

Please sign in to comment.