Skip to content

Commit 302be2f

Browse files
Add TASTy-MiMa to stdlib-bootstrapped (#17970)
* [Full TASTy-MiMa output](https://gist.github.com/nicolasstucki/9f99a4ed52474066097bf81c584691cc) [skip ci]
2 parents 89de881 + cc7a352 commit 302be2f

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed

project/Build.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import org.scalajs.sbtplugin.ScalaJSPlugin
2121
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
2222
import sbtbuildinfo.BuildInfoPlugin
2323
import sbtbuildinfo.BuildInfoPlugin.autoImport._
24+
import sbttastymima.TastyMiMaPlugin
25+
import sbttastymima.TastyMiMaPlugin.autoImport._
2426

2527
import scala.util.Properties.isJavaAtLeast
2628
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
@@ -994,6 +996,28 @@ object Build {
994996
"scala.annotation.specialized",
995997
"scala.annotation.unspecialized",
996998
),
999+
tastyMiMaPreviousArtifacts += "org.scala-lang" % "scala-library" % stdlibVersion(Bootstrapped),
1000+
tastyMiMaCurrentClasspath := {
1001+
val javaBootCp = tastyMiMaJavaBootClasspath.value
1002+
val classDir = (Compile / classDirectory).value.toPath()
1003+
val cp0 = Attributed.data((Compile / fullClasspath).value).map(_.toPath())
1004+
val cp: Seq[Path] = classDir +: (javaBootCp ++ cp0)
1005+
(cp, classDir)
1006+
},
1007+
tastyMiMaConfig ~= { _.withMoreProblemFilters(TastyMiMaFilters.StdlibBootstrapped) },
1008+
tastyMiMaReportIssues := tastyMiMaReportIssues.dependsOn(Def.task {
1009+
val minorVersion = previousDottyVersion.split('.')(1)
1010+
// TODO find a way around this and test in the CI
1011+
streams.value.log.warn(
1012+
s"""To allow TASTy-MiMa to read TASTy files generated by this vesion of the compile you must:
1013+
| * Modify the TASTy version to the latest stable release (latest version supported by TASTy-MiMa) in in tasty/src/dotty/tools/tasty/TastyFormat.scala
1014+
| - final val MinorVersion = $minorVersion
1015+
| - final val ExperimentalVersion = 0
1016+
| * Clean everiting to generate a compiler with those new TASTy vesrions
1017+
| * Run stdlib-bootstrapped/tastyMiMaReportIssues
1018+
|""".stripMargin)
1019+
1020+
}).value,
9971021
// TODO package only TASTy files.
9981022
// We first need to check that a project can depend on a JAR that only contains TASTy files.
9991023
// Compile / exportJars := true,

project/TastyMiMaFilters.scala

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import java.util.Arrays.asList
2+
import tastymima.intf._
3+
4+
object TastyMiMaFilters {
5+
val StdlibBootstrapped: java.util.List[ProblemMatcher] = asList(
6+
// OK
7+
ProblemMatcher.make(ProblemKind.MissingClass, "scala.*.<local child>"),
8+
9+
// Probably OK
10+
ProblemMatcher.make(ProblemKind.InternalError, "scala.*"),
11+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.*$extension"),
12+
ProblemMatcher.make(ProblemKind.IncompatibleSelfTypeChange, "scala.*"),
13+
14+
// Probably OK: by-name arguments in signatures
15+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.App.delayedInit"),
16+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Array.fill"),
17+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*.fill"),
18+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*.getOrElse"),
19+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*.getOrElseUpdate"),
20+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.jdk.Accumulator.fill"),
21+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Option.*"), // fold, toLeft, toRight, unless, when
22+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Option.getOrElse"),
23+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Option.orElse"),
24+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Predef.*"), // assert, assume, require, Ensuring.ensuring
25+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.*.getOrElse"),
26+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.*.orElse"),
27+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.Try.apply"),
28+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.Using.apply"),
29+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.Using.resources"),
30+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.concurrent.Future.*"), // apply, delegate
31+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.Console.*"), // withErr, withIn, withOut
32+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.DelayedInit.delayedInit"),
33+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.io.Codec.wrap"),
34+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.PropertiesTrait.*"), // envOrElse, envOrSome, propOrElse, scalaPropOrElse
35+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.Either.cond"),
36+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.Either.filterOrElse"),
37+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.control.Breaks.*"), // breakable, TryBlock.catchBreak, tryBreakable
38+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.control.Exception.Catch.*"), // andFinally, apply,either, opt, withTry
39+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.control.Exception.*"), // failAsValue, Finally.and, ultimately
40+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.control.TailCalls.tailcall"),
41+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.DynamicVariable.withValue"),
42+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.FileProcessLogger.*"), // buffer, err, out
43+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessImpl.Spawn.apply"),
44+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.processInternal.*"), // onInterrupt, onIOInterrupt
45+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessLogger.*"), // buffer, err, out
46+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.PropImpl.or"),
47+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.ShutdownHookThread.apply"),
48+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.SystemProperties.*"), // exclusively, wrapAccess
49+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.immutable.LazyList.*"), // cons.apply, continually, Deferrer.#::, iterate, lazyAppendedAll, toDeferrer
50+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.immutable.Stream.*"), // append, cons.apply, continually, lazyAppendedAll, toDeferrer
51+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.Iterator.*"), // ++, concat, continually, GroupedIterator.withPadding
52+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.concurrent.BlockContext.*"), // blockOn, withBlockContext
53+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilder.FileBuilder.#<<"),
54+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilderImpl.FileImpl.#<<"),
55+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilder.Sink.#<"),
56+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilder.Source.#>"),
57+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessCreation.apply"),
58+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.concurrent.BatchingExecutorStatics.MissingParentBlockContext.blockOn"),
59+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessImpl.CompoundProcess.runInterruptible"),
60+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.util.hashing.Hashing.fromFunction"),
61+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.IterableOnceOps.aggregate"),
62+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.package.addShutdownHook"),
63+
64+
// Problems with class constructors
65+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.*.<init>"),
66+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.*.<init>"),
67+
ProblemMatcher.make(ProblemKind.RestrictedVisibilityChange, "scala.*.<init>"),
68+
69+
// Problem: Missing trait constructor
70+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.*.$init$"),
71+
72+
// Problem: default parameter
73+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.*$default$*"), // To check (semantic names vs mangled name?)
74+
75+
// Problem: Missing Serializable in companions of serializable classes
76+
ProblemMatcher.make(ProblemKind.MissingParent, "scala.*$"),
77+
78+
// Problem: Class[T] or ClassTag[T] return type
79+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.*.getClass"),
80+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.reflect.ManifestFactory.*.runtimeClass"),
81+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*.elemTag"),
82+
83+
// Problem: Case class with private constructor
84+
ProblemMatcher.make(ProblemKind.RestrictedVisibilityChange, "scala.concurrent.duration.Deadline.apply"),
85+
ProblemMatcher.make(ProblemKind.RestrictedVisibilityChange, "scala.concurrent.duration.Deadline.copy"),
86+
87+
// Problem: Missing type arguments with higher-kinded types
88+
ProblemMatcher.make(ProblemKind.MissingTypeMember, "scala.collection.SortedSetFactoryDefaults._$5"),
89+
ProblemMatcher.make(ProblemKind.MissingTypeMember, "scala.collection.SortedMapFactoryDefaults._$6"),
90+
91+
// Problem: Incompatible type change of higher-kinded types
92+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*CC"),
93+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.*.C"),
94+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.jdk.Accumulator.CC"),
95+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.EvidenceIterableFactory*.Ev"),
96+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.mutable.package.LinearSeq"),
97+
98+
// Problem: Incompatible type change is `with` intersection types
99+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.convert.impl.*.Semi"),
100+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.immutable.*MapOps.coll"),
101+
102+
// Problem: Refined type in signature
103+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.runtime.ScalaRunTime.drop"),
104+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.generic.IsMap.Tupled"),
105+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsMap.*IsMap"),
106+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsSeq.*IsSeq"),
107+
108+
// Problem: Case class with varargs
109+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.StringContext.parts"),
110+
111+
// Problem: Inferred result type of non-private member differs
112+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.convert.JavaCollectionWrappers.*.iterableFactory"),
113+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.convert.JavaCollectionWrappers.*.empty"),
114+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.convert.JavaCollectionWrappers.*.mapFactory"),
115+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.mutable.LinkedHash*.newBuilder"),
116+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.math.Big*.underlying"),
117+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.math.Ordering.tryCompare"),
118+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.immutable.TreeSet.sortedIterableFactory"),
119+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.immutable.BitSet.bitSetFactory"),
120+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.mutable.BitSet.bitSetFactory"),
121+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.View.*PartitionMapped.iterator"),
122+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilderImpl.*.toSink"),
123+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.sys.process.ProcessBuilderImpl.*.toSource"),
124+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.concurrent.duration.FiniteDuration.unary_-"),
125+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.convert.JavaCollectionWrappers.IteratorWrapper.remove"),
126+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.convert.JavaCollectionWrappers.IterableWrapperTrait.iterator"),
127+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.util.matching.Regex.MatchIterator.replacementData"),
128+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.sys.process.ProcessBuilderImpl.*.createProcess"),
129+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.mutable.TreeMap.sortedMapFactory"),
130+
131+
// Problem: implicit class (method should not be final)
132+
ProblemMatcher.make(ProblemKind.FinalMember, "scala.collection.convert.*.*"),
133+
134+
// Problem: implicit class
135+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsIterableLowPriority.is*LikeIsIterable"),
136+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsIterableOnce.iterableOnceIsIterableOnce"),
137+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsIterableOnceLowPriority.isIterableLikeIsIterableOnce"),
138+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.generic.IsIterable.*OpsIsIterable"),
139+
140+
// Non-categorized
141+
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.mutable.HashTable.init"),
142+
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.collection.immutable.::.next$access$1"),
143+
ProblemMatcher.make(ProblemKind.MissingTypeMember, "scala.collection.generic.DefaultSerializable._$1"),
144+
ProblemMatcher.make(ProblemKind.NewAbstractMember, "scala.collection.convert.impl.*_="),
145+
ProblemMatcher.make(ProblemKind.NewAbstractMember, "scala.math.ScalaNumericConversions.underlying"),
146+
ProblemMatcher.make(ProblemKind.NewAbstractMember, "scala.*.superscala$*$*$$*"),
147+
)
148+
}

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.5")
1919
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
2020

2121
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.2")
22+
23+
addSbtPlugin("ch.epfl.scala" % "sbt-tasty-mima" % "0.3.0")

0 commit comments

Comments
 (0)