Skip to content

Backport "Improve the usage of inclusive language" to 3.3 LTS #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2025
Merged
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 compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ object Contexts {
* risk of capturing complete trees.
* - To make sure these rules are kept, it would be good to do a sanity
* check using bytecode inspection with javap or scalap: Keep track
* of all class fields of type context; allow them only in whitelisted
* of all class fields of type context; allow them only in allowlisted
* classes (which should be short-lived).
*/
abstract class Context(val base: ContextBase) { thiscontext =>
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Names.scala
Original file line number Diff line number Diff line change
@@ -401,7 +401,7 @@ object Names {
}

/** It's OK to take a toString if the stacktrace does not contain a method
* from GenBCode or it also contains one of the whitelisted methods below.
* from GenBCode or it also contains one of the allowed methods below.
*/
private def toStringOK = {
val trace: Array[StackTraceElement] = Thread.currentThread.nn.getStackTrace.asInstanceOf[Array[StackTraceElement]]
Original file line number Diff line number Diff line change
@@ -904,7 +904,7 @@ class ClassfileParser(

// Nothing$ and Null$ were incorrectly emitted with a Scala attribute
// instead of ScalaSignature before 2.13.0-M2, see https://github.com/scala/scala/pull/5952
private val scalaUnpickleWhitelist = List(tpnme.nothingClass, tpnme.nullClass)
private val scalaUnpickleAllowlist = List(tpnme.nothingClass, tpnme.nullClass)

/** Parse inner classes. Expects `in.bp` to point to the superclass entry.
* Restores the old `bp`.
@@ -1028,7 +1028,7 @@ class ClassfileParser(
report.error(s"Found a TASTY attribute with a length different from 16 in $classfile. This is likely a bug in the compiler. Please report.", NoSourcePosition)
}

if scan(tpnme.ScalaATTR) && !scalaUnpickleWhitelist.contains(classRoot.name)
if scan(tpnme.ScalaATTR) && !scalaUnpickleAllowlist.contains(classRoot.name)
&& !(classRoot.name.startsWith("Tuple") && classRoot.name.endsWith("$sp"))
&& !(classRoot.name.startsWith("Product") && classRoot.name.endsWith("$sp"))
then
23 changes: 23 additions & 0 deletions compiler/test/dotc/neg-best-effort-pickling.excludelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export-in-extension.scala
i12456.scala
i8623.scala
i1642.scala
i16696.scala
constructor-proxy-values.scala
i9328.scala
i15414.scala
i6796.scala
i14013.scala
toplevel-cyclic
curried-dependent-ift.scala
i17121.scala
illegal-match-types.scala
i13780-1.scala
i20317a.scala
i11226.scala
i974.scala
i13864.scala

# semantic db generation fails in the first compilation
i1642.scala
i15158.scala
17 changes: 17 additions & 0 deletions compiler/test/dotc/neg-best-effort-unpickling.excludelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# cyclic reference crashes
i4368.scala
i827.scala
cycles.scala
i5332.scala
i4369c.scala
i1806.scala
i0091-infpaths.scala
exports.scala
i14834.scala

# other type related crashes
i4653.scala
overrideClass.scala

# repeating <error> on a top level type definition
i18750.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## See #18882
patmat.scala
t9312.scala
unapplySeq-implicit-arg.scala
unapplySeq-implicit-arg2.scala
unapplySeq-implicit-arg3.scala
ScalaCheck.scala
mutable-read8.scala
TypeCast.scala
global-cycle8.scala
global-cycle6.scala
i12544b.scala
t9360.scala
mutable-array.scala
patmat-unapplySeq2.scala
line-spacing.scala
global-list.scala
t5366.scala
mutable-read7.scala
t9115.scala
Color.scala
2 changes: 2 additions & 0 deletions compiler/test/dotc/neg-scala2-library-tasty.excludelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
i8752.scala
f-interpolator-neg.scala # Additional: A pure expression does nothing in statement position
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
t7746.scala # order of exhaustivity suggestions differs
t4408.scala # order of exhaustivity suggestions differs
patmat-ortype.scala # order of exhaustivity suggestions differs
i13003.scala # order of exhaustivity suggestions differs
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## See #18882
patmat.scala
patmat-interpolator.scala
unapplySeq-implicit-arg-pos.scala
global-cycle11.scala
143 changes: 143 additions & 0 deletions compiler/test/dotc/pos-test-pickling.excludelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
i94-nada.scala
i1812.scala
i1867.scala
i3067.scala
t2712-5.scala
t284-pos.scala
t3249
t3486
t3612.scala
reference
scala-days-2019-slides
i7048e.scala
i8052.scala
tuple-filter.scala
i7740a.scala
i7740b.scala
i6507b.scala
i12299a.scala
i13871.scala
i15181.scala
i15922.scala
i15926.scala
t5031_2.scala
i16997.scala
i7414.scala
i17588.scala
i8300.scala
i9804.scala
i13433.scala
i16649-irrefutable.scala
strict-pattern-bindings-3.0-migration.scala
i17186b.scala
i11982a.scala
i17255
i17735.scala

# Tree is huge and blows stack for printing Text
i7034.scala

# Causes cyclic reference by interacting with compiler stdlib types
stdlib

# Stale symbol: package object scala
seqtype-cycle

# type of super reference changes due to late addition of Mirror.Singleton
i939.scala
i13332super.scala

# Match types
i7872.scala
i11236.scala
i11247.scala
i11250
i9999.scala
8649.scala
12093.scala
9757.scala
9890.scala
13491.scala
7512.scala
i6505.scala
i15158.scala
i15155.scala
i15827.scala
i17149.scala
tuple-fold.scala
mt-redux-norm.perspective.scala
i18211.scala
10867.scala
named-tuples1.scala
i20897.scala
i20512.scala

# Opaque type
i5720.scala

# Tuples
toexproftuple.scala
i7580.scala

# Nullability
nullable.scala

# parameter untupling with overloaded functions (see comment in Applications.normArg)
i7757.scala

# splice type tag dealiased in this reference
i8651b.scala

# uneliminated @uncheckedVariance after pickling
annot-bootstrap.scala

# interaction with Scala-2's implicitly
i9793.scala

# lazy_implicit symbol has different position after pickling
i8182.scala

# local lifted value in annotation argument has different position after pickling
i2797a

# Late instantiation of type variable in tryInsertImplicitOnQualifier
# allows to simplify a type that was already computed
i13842.scala

# Position change under captureChecking
boxmap-paper.scala

# Function types print different after unpickling since test mispredicts Feature.preFundsEnabled
caps-universal.scala

# GADT cast applied to singleton type difference
i4176-gadt.scala

# GADT difference
i13974a.scala
i15867.scala

java-inherited-type1

# recursion limit exceeded
i7445b.scala

# more aggresive reduce projection makes a difference
i15525.scala
i19955a.scala
i19955b.scala
i20053b.scala

# alias types at different levels of dereferencing
parsercombinators-givens.scala
parsercombinators-givens-2.scala
parsercombinators-ctx-bounds.scala
parsercombinators-this.scala
parsercombinators-arrow.scala
parsercombinators-new-syntax.scala
hylolib-deferred-given
hylolib-cb
hylolib

# typecheckErrors method unpickling
i21415.scala
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Checkfile differences for equivalent type
tasty-extractors-1
tasty-extractors-2
tasty-extractors-types
type-print
52 changes: 52 additions & 0 deletions compiler/test/dotc/run-test-pickling.excludelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Many of these tests fail because CompilationTests.pickling does not handle
## tests containing java files correctly

derive-generic.scala
eff-dependent.scala
enum-java
i5257.scala
i7212
i7868.scala
i9011.scala
i9473.scala
i13433.scala
i13433b.scala
macros-in-same-project1
mixin-forwarder-overload
t10889
t3452d
t3452e
t3452g
t7374
t8905
tuple-drop.scala
tuple-ops.scala
tuple-ops.scala
tuple-take.scala
tuple-zip.scala
tuples1.scala
tuples1a.scala
tuples1b.scala
typeclass-derivation-doc-example.scala
typeclass-derivation1.scala
typeclass-derivation2.scala
typeclass-derivation2a.scala
typeclass-derivation2b.scala
typeclass-derivation2c.scala
typeclass-derivation2d.scala
typeclass-derivation3.scala
varargs-abstract
zero-arity-case-class.scala
i12194.scala
i12753
t6138
t6138-2
i12656.scala
trait-static-forwarder
i17255
named-tuples-strawman-2.scala

# typecheckErrors method unpickling
typeCheckErrors.scala
i18150.scala

17 changes: 8 additions & 9 deletions compiler/test/dotty/tools/TestSources.scala
Original file line number Diff line number Diff line change
@@ -11,28 +11,27 @@ object TestSources {

// pos tests lists

def posFromTastyBlacklistFile: String = "compiler/test/dotc/pos-from-tasty.blacklist"
def posTestPicklingBlacklistFile: String = "compiler/test/dotc/pos-test-pickling.blacklist"
def posFromTastyExcludelistFile: String = "compiler/test/dotc/pos-from-tasty.excludelist"
def posTestPicklingExcludelistFile: String = "compiler/test/dotc/pos-test-pickling.excludelist"
def posTestRecheckExcludesFile: String = "compiler/test/dotc/pos-test-recheck.excludes"
def posLazyValsAllowlistFile: String = "compiler/test/dotc/pos-lazy-vals-tests.allowlist"
def posLintingAllowlistFile: String = "compiler/test/dotc/pos-linting.allowlist"

def posFromTastyBlacklisted: List[String] = loadList(posFromTastyBlacklistFile)
def posTestPicklingBlacklisted: List[String] = loadList(posTestPicklingBlacklistFile)
def posFromTastyExcludelisted: List[String] = loadList(posFromTastyExcludelistFile)
def posTestPicklingExcludelisted: List[String] = loadList(posTestPicklingExcludelistFile)
def posTestRecheckExcluded: List[String] = loadList(posTestRecheckExcludesFile)
def posLazyValsAllowlist: List[String] = loadList(posLazyValsAllowlistFile)
def posLintingAllowlist: List[String] = loadList(posLintingAllowlistFile)

// run tests lists

def runFromTastyBlacklistFile: String = "compiler/test/dotc/run-from-tasty.blacklist"
def runTestPicklingBlacklistFile: String = "compiler/test/dotc/run-test-pickling.blacklist"
def runFromTastyExcludelistFile: String = "compiler/test/dotc/run-from-tasty.excludelist"
def runTestPicklingExcludelistFile: String = "compiler/test/dotc/run-test-pickling.excludelist"
def runTestRecheckExcludesFile: String = "compiler/test/dotc/run-test-recheck.excludes"
def runLazyValsAllowlistFile: String = "compiler/test/dotc/run-lazy-vals-tests.allowlist"


def runFromTastyBlacklisted: List[String] = loadList(runFromTastyBlacklistFile)
def runTestPicklingBlacklisted: List[String] = loadList(runTestPicklingBlacklistFile)
def runFromTastyExcludelisted: List[String] = loadList(runFromTastyExcludelistFile)
def runTestPicklingExcludelisted: List[String] = loadList(runTestPicklingExcludelistFile)
def runTestRecheckExcluded: List[String] = loadList(runTestRecheckExcludesFile)
def runLazyValsAllowlist: List[String] = loadList(runLazyValsAllowlistFile)

4 changes: 2 additions & 2 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
@@ -170,8 +170,8 @@ class CompilationTests {
@Test def pickling: Unit = {
implicit val testGroup: TestGroup = TestGroup("testPickling")
aggregateTests(
compileFilesInDir("tests/pos", picklingOptions, FileFilter.exclude(TestSources.posTestPicklingBlacklisted)),
compileFilesInDir("tests/run", picklingOptions, FileFilter.exclude(TestSources.runTestPicklingBlacklisted))
compileFilesInDir("tests/pos", picklingOptions, FileFilter.exclude(TestSources.posTestPicklingExcludelisted)),
compileFilesInDir("tests/run", picklingOptions, FileFilter.exclude(TestSources.runTestPicklingExcludelisted))
).checkCompile()
}

4 changes: 2 additions & 2 deletions compiler/test/dotty/tools/dotc/FromTastyTests.scala
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ class FromTastyTests {

implicit val testGroup: TestGroup = TestGroup("posTestFromTasty")
compileTastyInDir(s"tests${JFile.separator}pos", defaultOptions,
fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyBlacklisted)
fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyExcludelisted)
).checkCompile()
}

@@ -35,7 +35,7 @@ class FromTastyTests {

implicit val testGroup: TestGroup = TestGroup("runTestFromTasty")
compileTastyInDir(s"tests${JFile.separator}run", defaultOptions,
fromTastyFilter = FileFilter.exclude(TestSources.runFromTastyBlacklisted)
fromTastyFilter = FileFilter.exclude(TestSources.runFromTastyExcludelisted)
).checkRuns()
}
}
Loading