Skip to content

Commit 3c9ff69

Browse files
committed
Upgrade to Scala 3.4.2.
And apply changes due to scala/scala3#19761
1 parent 59811cb commit 3c9ff69

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import sbt.internal.util.ManagedLogger
33

44
import org.scalajs.jsenv.nodejs.NodeJSEnv
55

6-
val usedScalaCompiler = "3.4.0"
6+
val usedScalaCompiler = "3.4.2"
77
val usedTastyRelease = usedScalaCompiler
88
val scala2Version = "2.13.14"
99

tasty-query/shared/src/test/scala/tastyquery/PrintersTest.scala

+16-6
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
211211
)
212212

213213
val MatchTypeClass = ctx.findTopLevelClass("simple_trees.MatchType")
214-
testShowBasicMember(MatchTypeClass, typeName("MT"), "type MT[X] = X match { case Int => String }")
214+
testShowBasicMember(
215+
MatchTypeClass,
216+
typeName("MT"),
217+
"type MT[X] <: scala.Predef.String = X match { case Int => String }"
218+
)
215219
testShowBasicMember(
216220
MatchTypeClass,
217221
typeName("MTWithBound"),
@@ -220,9 +224,14 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
220224
testShowBasicMember(
221225
MatchTypeClass,
222226
typeName("MTWithWildcard"),
223-
"type MTWithWildcard[X] = X match { case _ => Int }"
227+
"type MTWithWildcard[X] <: scala.Int = X match { case _ => Int }"
228+
)
229+
// The `<: t` is completely wrong. See https://github.com/scala/scala3/issues/21256
230+
testShowBasicMember(
231+
MatchTypeClass,
232+
typeName("MTWithBind"),
233+
"type MTWithBind[X] <: t = X match { case List[t] => t }"
224234
)
225-
testShowBasicMember(MatchTypeClass, typeName("MTWithBind"), "type MTWithBind[X] = X match { case List[t] => t }")
226235
}
227236

228237
testWithContext("multiline tree printers") {
@@ -286,7 +295,7 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
286295
testShowMultilineMember(
287296
MatchTypeClass,
288297
typeName("MT"),
289-
"""type MT[X] = X match {
298+
"""type MT[X] <: scala.Predef.String = X match {
290299
| case Int => String
291300
|}""".stripMargin
292301
)
@@ -300,14 +309,15 @@ class PrintersTest extends UnrestrictedUnpicklingSuite:
300309
testShowMultilineMember(
301310
MatchTypeClass,
302311
typeName("MTWithWildcard"),
303-
"""type MTWithWildcard[X] = X match {
312+
"""type MTWithWildcard[X] <: scala.Int = X match {
304313
| case _ => Int
305314
|}""".stripMargin
306315
)
316+
// The `<: t` is completely wrong. See https://github.com/scala/scala3/issues/21256
307317
testShowMultilineMember(
308318
MatchTypeClass,
309319
typeName("MTWithBind"),
310-
"""type MTWithBind[X] = X match {
320+
"""type MTWithBind[X] <: t = X match {
311321
| case List[t] => t
312322
|}""".stripMargin
313323
)

tasty-query/shared/src/test/scala/tastyquery/ReadTreeSuite.scala

+10-8
Original file line numberDiff line numberDiff line change
@@ -1904,8 +1904,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
19041904
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
19051905
TypeAliasDefinitionTree(
19061906
MatchTypeTree(
1907-
// No bound on the match result
1908-
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
1907+
// No bound on the match result -- inferred to be String since 3.4.2
1908+
TypeWrapper(TypeRefInternal(_, tpnme.String)),
19091909
TypeIdent(SimpleTypeName("X")),
19101910
List(TypeCaseDef(TypeIdent(SimpleTypeName("Int")), TypeIdent(SimpleTypeName("String"))))
19111911
)
@@ -1946,8 +1946,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
19461946
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
19471947
TypeAliasDefinitionTree(
19481948
MatchTypeTree(
1949-
// No bound on the match result
1950-
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
1949+
// No bound on the match result -- inferred since 3.4.2
1950+
TypeWrapper(_),
19511951
TypeIdent(SimpleTypeName("X")),
19521952
List(TypeCaseDef(TypeIdent(tpnme.Wildcard), TypeIdent(SimpleTypeName("Int"))))
19531953
)
@@ -1965,8 +1965,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
19651965
List(TypeParam(SimpleTypeName("X"), NothingAnyTypeBoundsTree(), _)),
19661966
TypeAliasDefinitionTree(
19671967
MatchTypeTree(
1968-
// No bound on the match result
1969-
TypeWrapper(TypeRefInternal(ScalaPackageRef(), tpnme.Any)),
1968+
// No bound on the match result -- inferred since 3.4.2
1969+
TypeWrapper(_),
19701970
TypeIdent(SimpleTypeName("X")),
19711971
List(
19721972
TypeCaseDef(
@@ -1995,7 +1995,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
19951995
Select(rhs, SignedName(SimpleName("$asInstanceOf$"), _, _)),
19961996
TypeWrapper(
19971997
ty.MatchType(
1998-
TypeRefInternal(ScalaPackageRef(), SimpleTypeName("Any")),
1998+
// No bound on the match result -- inferred since 3.4.2
1999+
_,
19992000
TypeRefInternal(_, xRef),
20002001
List(
20012002
ty.MatchTypeCase(
@@ -2026,7 +2027,8 @@ class ReadTreeSuite extends RestrictedUnpicklingSuite {
20262027
Select(rhs, SignedName(SimpleName("$asInstanceOf$"), _, _)),
20272028
TypeWrapper(
20282029
ty.MatchType(
2029-
TypeRefInternal(ScalaPackageRef(), SimpleTypeName("Any")),
2030+
// No bound on the match result -- inferred since 3.4.2
2031+
_,
20302032
TypeRefInternal(_, xRef),
20312033
List(
20322034
ty.MatchTypeCase(

tasty-query/shared/src/test/scala/tastyquery/SignatureSuite.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ class SignatureSuite extends UnrestrictedUnpicklingSuite:
408408
val MatchType = ctx.findTopLevelClass("simple_trees.MatchType")
409409

410410
val unboundUnreducibleSig = MatchType.findNonOverloadedDecl(termName("unboundUnreducibleSig"))
411-
assertSigned(unboundUnreducibleSig, "(1,java.lang.Object):java.lang.Object")
411+
// Was "(1,java.lang.Object):java.lang.Object" < 3.4.2
412+
assertSigned(unboundUnreducibleSig, "(1,java.lang.Object):java.lang.String")
412413

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

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

426428
val arrayOfUnboundReducibleSig = MatchType.findNonOverloadedDecl(termName("arrayOfUnboundReducibleSig"))
427429
assertSigned(arrayOfUnboundReducibleSig, "(1,scala.Int):java.lang.String[]")

test-sources/src/main/scala/simple_trees/AccessModifiers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package simple_trees
22

33
import scala.annotation.nowarn
44

5-
@nowarn("msg=The \\[this\\] qualifier will be deprecated")
5+
@nowarn("msg=Ignoring \\[this\\] qualifier")
66
class AccessModifiers(
77
localParam: Int,
88
private[this] val privateThisParam: Int,

0 commit comments

Comments
 (0)