Skip to content

Commit 0d8a36c

Browse files
authored
Merge branch 'main' into feature-named-tuples-to-map-std
2 parents f9d65f8 + ca400bd commit 0d8a36c

File tree

185 files changed

+96
-59174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+96
-59174
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -157,59 +157,6 @@ jobs:
157157
run: |
158158
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
159159
160-
- name: Test with Scala 2 library TASTy (fast)
161-
run: ./project/scripts/sbt ";set ThisBuild/Build.scala2Library := Build.Scala2LibraryTasty ;scala3-bootstrapped/testCompilation i5; scala3-bootstrapped/testCompilation tests/run/typelevel-peano.scala; scala3-bootstrapped/testOnly dotty.tools.backend.jvm.DottyBytecodeTests" # only test a subset of test to avoid doubling the CI execution time
162-
163-
- name: Test with Scala 2 library with CC TASTy (fast)
164-
run: ./project/scripts/sbt ";set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty; scala2-library-cc/compile; scala2-library-cc-tasty/compile; scala3-bootstrapped/testCompilation i3"
165-
166-
test_scala2_library_tasty:
167-
runs-on: [self-hosted, Linux]
168-
container:
169-
image: lampepfl/dotty:2024-10-18
170-
options: --cpu-shares 4096
171-
volumes:
172-
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
173-
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
174-
- ${{ github.workspace }}/../../cache/general:/root/.cache
175-
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
176-
|| (
177-
github.event_name == 'pull_request'
178-
&& contains(github.event.pull_request.body, '[test_scala2_library_tasty]')
179-
)
180-
|| (
181-
github.event_name == 'workflow_dispatch'
182-
&& github.repository == 'scala/scala3'
183-
)"
184-
185-
steps:
186-
- name: Set JDK 17 as default
187-
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
188-
189-
- name: Reset existing repo
190-
run: |
191-
git config --global --add safe.directory $GITHUB_WORKSPACE
192-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
193-
194-
- name: Checkout cleanup script
195-
uses: actions/checkout@v5
196-
197-
- name: Cleanup
198-
run: .github/workflows/cleanup.sh
199-
200-
- name: Git Checkout
201-
uses: actions/checkout@v5
202-
203-
- name: Add SBT proxy repositories
204-
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
205-
206-
- name: Test with Scala 2 library TASTy
207-
run: ./project/scripts/sbt ";set ThisBuild/Build.scala2Library := Build.Scala2LibraryTasty ;scala3-bootstrapped/test"
208-
209-
- name: Test with Scala 2 library with CC TASTy
210-
run: ./project/scripts/sbt ";set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty ;scala3-bootstrapped/test"
211-
212-
213160
test_windows_fast:
214161
runs-on: [self-hosted, Windows]
215162
if: "(
@@ -334,12 +281,7 @@ jobs:
334281

335282
- name: MiMa
336283
run: |
337-
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues; scala2-library-bootstrapped/mimaReportBinaryIssues"
338-
339-
- name: TASTy MiMa
340-
run: |
341-
# This script cleans the compiler and recompiles it from scratch (keep as last run)
342-
./project/scripts/scala2-library-tasty-mima.sh
284+
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues;"
343285
344286
community_build_a:
345287
runs-on: [self-hosted, Linux]

.github/workflows/publish-sdkman.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- platform: WINDOWS_64
4747
archive : 'scala3-${{ inputs.version }}-x86_64-pc-win32.zip'
4848
steps:
49-
- uses: sdkman/sdkman-release-action@2800d4359ae097a99afea7e0370f0c6e726182a4
49+
- uses: sdkman/sdkman-release-action@c70225d437d17182d19476702b671513dc8bf048
5050
with:
5151
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
5252
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}

.github/workflows/test-cc.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

build.sbt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ val `scala3-language-server` = Build.`scala3-language-server`
2828
val `scala3-bench` = Build.`scala3-bench`
2929
val `scala3-bench-bootstrapped` = Build.`scala3-bench-bootstrapped`
3030
val `scala3-bench-micro` = Build.`scala3-bench-micro`
31-
val `scala2-library-bootstrapped` = Build.`scala2-library-bootstrapped`
32-
val `scala2-library-tasty` = Build.`scala2-library-tasty`
33-
val `scala2-library-cc` = Build.`scala2-library-cc`
34-
val `scala2-library-cc-tasty` = Build.`scala2-library-cc-tasty`
3531
val `tasty-core` = Build.`tasty-core`
3632
val `tasty-core-nonbootstrapped` = Build.`tasty-core-nonbootstrapped`
3733
val `tasty-core-bootstrapped-new` = Build.`tasty-core-bootstrapped-new`

compiler/src/dotty/tools/backend/jvm/CodeGen.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
8585
case ex: InterruptedException => throw ex
8686
case ex: CompilationUnit.SuspendException => throw ex
8787
case ex: Throwable =>
88-
ex.printStackTrace()
89-
report.error(s"Error while emitting ${unit.source}\n${ex.getMessage}", NoSourcePosition)
88+
if !ex.isInstanceOf[TypeError] then ex.printStackTrace()
89+
report.error(s"Error while emitting ${unit.source}\n${ex.getMessage}", cd.sourcePos)
9090

9191

9292
def genTastyAndSetAttributes(claszSymbol: Symbol, store: ClassNode): Unit =

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,23 @@ object SymDenotations {
865865
* and is the denoting symbol also different from `Null` or `Nothing`?
866866
* @note erroneous classes are assumed to derive from all other classes
867867
* and all classes derive from them.
868+
* @note may return a false negative when `this.info.isInstanceOf[TempClassInfo]`.
868869
*/
869870
def derivesFrom(base: Symbol)(using Context): Boolean = false
870871

872+
/** Could `this` derive from `base` now or in the future.
873+
* For concistency with derivesFrom, the info is only forced when this is a ClassDenotation.
874+
* If the info is a TempClassInfo then the baseClassSet may be temporarily approximated as empty.
875+
* This is problematic when stability of `!derivesFrom(base)` is assumed for soundness,
876+
* e.g., in `TypeComparer#provablyDisjointClasses`.
877+
* @note may return a false positive when `this.info.isInstanceOf[TempClassInfo]`.
878+
*/
879+
final def mayDeriveFrom(base: Symbol)(using Context): Boolean =
880+
this.isInstanceOf[ClassDenotation] && (info.isInstanceOf[TempClassInfo] || derivesFrom(base))
881+
882+
final def derivesFrom(base: Symbol, defaultIfUnknown: Boolean)(using Context): Boolean =
883+
if defaultIfUnknown/*== true*/ then mayDeriveFrom(base) else derivesFrom(base)
884+
871885
/** Is this a Scala or Java annotation ? */
872886
def isAnnotation(using Context): Boolean =
873887
isClass && (derivesFrom(defn.AnnotationClass) || is(JavaAnnotation))

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,9 +3131,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
31313131
* unique value derives from the class.
31323132
*/
31333133
case (tp1: SingletonType, tp2) =>
3134-
!tp1.derivesFrom(tp2.classSymbol)
3134+
!tp1.derivesFrom(tp2.classSymbol, defaultIfUnknown = true)
31353135
case (tp1, tp2: SingletonType) =>
3136-
!tp2.derivesFrom(tp1.classSymbol)
3136+
!tp2.derivesFrom(tp1.classSymbol, defaultIfUnknown = true)
31373137

31383138
/* Now both sides are possibly-parameterized class types `p.C[Ts]` and `q.D[Us]`.
31393139
*
@@ -3189,7 +3189,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
31893189
val cls2BaseClassSet = SymDenotations.BaseClassSet(cls2.classDenot.baseClasses)
31903190
val commonBaseClasses = cls1.classDenot.baseClasses.filter(cls2BaseClassSet.contains(_))
31913191
def isAncestorOfOtherBaseClass(cls: ClassSymbol): Boolean =
3192-
commonBaseClasses.exists(other => (other ne cls) && other.derivesFrom(cls))
3192+
commonBaseClasses.exists(other => (other ne cls) && other.mayDeriveFrom(cls))
31933193
val result = commonBaseClasses.exists { baseClass =>
31943194
!isAncestorOfOtherBaseClass(baseClass) && isBaseTypeWithDisjointArguments(baseClass, innerPending)
31953195
}
@@ -3230,7 +3230,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
32303230
.filter(child => child.exists && child != cls)
32313231

32323232
def eitherDerivesFromOther(cls1: Symbol, cls2: Symbol): Boolean =
3233-
cls1.derivesFrom(cls2) || cls2.derivesFrom(cls1)
3233+
cls1.mayDeriveFrom(cls2) || cls2.mayDeriveFrom(cls1)
32343234

32353235
def smallestNonTraitBase(cls: Symbol): Symbol =
32363236
val classes = if cls.isClass then cls.asClass.baseClasses else cls.info.classSymbols

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,15 @@ object Types extends TypeUtils {
270270
/** True if this type is an instance of the given `cls` or an instance of
271271
* a non-bottom subclass of `cls`.
272272
*/
273-
final def derivesFrom(cls: Symbol)(using Context): Boolean = {
273+
final def derivesFrom(cls: Symbol, defaultIfUnknown: Boolean = false)(using Context): Boolean = {
274274
def isLowerBottomType(tp: Type) =
275275
tp.isBottomType
276276
&& (tp.hasClassSymbol(defn.NothingClass)
277277
|| cls != defn.NothingClass && !cls.isValueClass)
278278
def loop(tp: Type): Boolean = try tp match
279279
case tp: TypeRef =>
280280
val sym = tp.symbol
281-
if (sym.isClass) sym.derivesFrom(cls) else loop(tp.superType)
281+
if (sym.isClass) sym.derivesFrom(cls, defaultIfUnknown) else loop(tp.superType)
282282
case tp: AppliedType =>
283283
tp.superType.derivesFrom(cls)
284284
case tp: MatchType =>

compiler/test/dotty/Properties.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,11 @@ object Properties {
8181
/** scala-library jar */
8282
def scalaLibrary: String = sys.props("dotty.tests.classes.scalaLibrary")
8383

84-
/** scala-library TASTy jar */
85-
def scalaLibraryTasty: Option[String] = sys.props.get("dotty.tests.tasties.scalaLibrary")
84+
// TODO: Remove this once we migrate the test suite
85+
def usingScalaLibraryCCTasty: Boolean = false
8686

87-
/** If we are using the scala-library TASTy jar */
88-
def usingScalaLibraryTasty: Boolean = scalaLibraryTasty.isDefined
89-
/** If we are using the scala-library TASTy jar */
90-
91-
def usingScalaLibraryCCTasty: Boolean = scalaLibraryTasty.exists(_.contains("scala2-library-cc-tasty"))
87+
// TODO: Remove this once we migrate the test suite
88+
def usingScalaLibraryTasty: Boolean = false
9289

9390
/** scala-asm jar */
9491
def scalaAsm: String = sys.props("dotty.tests.classes.scalaAsm")

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import scala.language.unsafeNulls
77
import org.junit.{ Test, BeforeClass, AfterClass }
88
import org.junit.Assert._
99
import org.junit.Assume._
10+
import org.junit.Ignore
1011
import org.junit.experimental.categories.Category
1112

1213
import scala.concurrent.duration._
@@ -131,7 +132,7 @@ class BootstrappedOnlyCompilationTests {
131132
aggregateTests(tests*).checkRuns()
132133
}
133134

134-
@Test def runScala2LibraryFromTasty: Unit = {
135+
@Ignore @Test def runScala2LibraryFromTasty: Unit = {
135136
implicit val testGroup: TestGroup = TestGroup("runScala2LibraryFromTasty")
136137
// These tests recompile the entire scala2-library from TASTy,
137138
// they are resource intensive and should not run alongside other tests to avoid timeouts

0 commit comments

Comments
 (0)