Skip to content

Commit

Permalink
Merge branch 'main' into implement/Xlint/shadow_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
schuetzcarl committed Jun 20, 2023
2 parents 07f6581 + 6087911 commit 10c9af0
Show file tree
Hide file tree
Showing 323 changed files with 11,154 additions and 4,595 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: "\U0001F389 Suggest a feature"
about: Please create a feature request here https://github.com/lampepfl/dotty-feature-requests
about: Please create a feature request here https://github.com/lampepfl/dotty/discussions/new?category=feature-requests
title: ''
labels: ''
assignees: ''

---

Please create a feature request here: [lampepfl/dotty-feature-requests](https://github.com/lampepfl/dotty-feature-requests).
Please create a feature request in the [Dotty Discussions](https://github.com/lampepfl/dotty/discussions/new?category=feature-requests).
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ contributors.js
content-contributors.css
docs/_spec/_site/
docs/_spec/.jekyll-metadata

# scaladoc related
scaladoc/output/

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
url = https://github.com/dotty-staging/fastparse
[submodule "community-build/community-projects/stdLib213"]
path = community-build/community-projects/stdLib213
url = https://github.com/dotty-staging/scala
url = https://github.com/dotty-staging/scala213
[submodule "community-build/community-projects/sourcecode"]
path = community-build/community-projects/sourcecode
url = https://github.com/dotty-staging/sourcecode
Expand Down
3 changes: 2 additions & 1 deletion .vscode-template/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"**/*.class": true,
"**/*.tasty": true,
"**/target/": true,
"community-build/community-projects": true
"community-build/community-projects": true,
"tests/pos-with-compiler-cc/dotc/**/*.scala": true
}
}
6 changes: 5 additions & 1 deletion MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ The issue supervisor is responsible for:
- Attempting to reproduce the issue (or label “stat:cannot reproduce”)
- Further minimizing the issue or asking the reporter of the issue to minimize it correctly (or label “stat:needs minimization”)
- Identifying which issues are of considerable importance and bringing them to the attention of the team during the Dotty meeting, where they can be filtered and added to the [Future Versions](https://github.com/lampepfl/dotty/milestone/46) milestone.
- Identifying if a report is really a feature request and if so, converting it to
a [feature request discussion](https://github.com/lampepfl/dotty/discussions/categories/feature-requests).
- Keeping an eye on new
[discussions](https://github.com/lampepfl/dotty/discussions), making sure they
don't go unanswered and also correctly labeling new feature requests.

Other core teammates are responsible for providing information to the issue supervisor in a timely manner when it is requested if they have that information.

Expand All @@ -32,7 +37,6 @@ The issue supervisor schedule is maintained in the [Issue Supervisor Statistics
An issue supervisor needs to have all the accesses and privileges required to get their job done. This might include:

- Admin rights in lampepfl/dotty repository
- Admin rights in lampepfl/dotty-feature-requests repository
- Permission to create new repositories in lampepfl organization (needed to fork repositories for the community build)
- Access to the LAMP slack to be able to ask for help with the infrastructure, triaging and such

Expand Down
76 changes: 3 additions & 73 deletions community-build/README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,5 @@
# Scala 3 Community Build

This project contains tests to build and test a corpus of open sources Scala
projects against the latest version of Scala 3.

## Running it locally

To run the community build on a local machine, first fetch all the git
submodules with `git submodule update --init` and run `sbt community-build/test`
from the root of the dotty repo.

To run a single project, you can use the usual syntax for running a single JUnit
test, for example `community-build/testOnly -- *shapeless`

In CI the community build is split up into 3 seperate groups: A, B, and C. To
run one specific build you can also use the same JUnit syntax as above targeting
the individual group. For example:

```
sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestA"
```

## Adding your project

The community build is able to handle both Mill and sbt projects. To add your
project to the community build you can follow these steps:

1. Ensure your project is compiling with Scala 3. If you need help make sure to
check out the [Scala 3 Migration
Guide](https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html).
You can see the submodules in
[community-projects](https://github.com/lampepfl/dotty/tree/main/community-build/community-projects/)
for examples of projects that compile with Scala 3.

2. Open a PR against this repo that:
- Adds your project as a new git submodule
- `git submodule add https://github.com/dotty-staging/XYZ.git community-build/community-projects/XYZ`
- Add the project to [projects.scala](https://github.com/lampepfl/dotty/blob/main/community-build/src/scala/dotty/communitybuild/projects.scala)
- Adds a test in [CommunityBuildTest.scala](https://github.com/lampepfl/dotty/blob/main/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala)

3. Once the CI is green, someone from the Dotty team will fork your repo and add
it to [dotty-staging](https://github.com/dotty-staging). This enables us to
make changes to your fork if necessary to keep the community build running
smoothly.

4. Once the fork is created, please update your PR to point to this new fork
instead of your repo.

## Updating a project

The projects included in the community build are all forked and located in
[dotty-staging](https://github.com/dotty-staging). When something needs to be
bumped the process is as follows:

1. Fork the dotty staging repo and sync it with the upstream project.

2. Once you've verified that the tests are all passing you can then either
request in your PR that the dotty-staging fork be synced or in the
[scala-contributors](https://discord.com/channels/632150470000902164/632628489719382036)
discord channel.

### Some helpful tips

- If you're unfamiliar with Git Submodules you can find a nice guide to get
familiar with them [here](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
- Keep in mind that many projects are interrelated. So when you bump one that
change may cascade through multiple different projects causing you to have
to bump multiple. Plan accordingly and at times it's best to pin it to a
stable release version, especially if it's a root library that many others
in the community build are relying on.

## Looking for the "unmanaged" Scala 3 community build?

You can find this [here](https://github.com/VirtusLab/community-build3).

For information on the community build check out the [Community Build section of
the Contributing
Docs](https://dotty.epfl.ch/docs/contributing/community-build.html).
2 changes: 1 addition & 1 deletion community-build/community-projects/munit
2 changes: 1 addition & 1 deletion community-build/community-projects/specs2
Submodule specs2 updated 44 files
+6 −0 .git-blame-ignore-revs
+14 −36 .github/workflows/ci.yml
+1 −1 .scalafmt.conf
+8 −5 build.sbt
+13 −10 common/shared/src/main/scala/org/specs2/collection/Seqx.scala
+1 −1 common/shared/src/main/scala/org/specs2/control/Action.scala
+36 −24 common/shared/src/main/scala/org/specs2/execute/Result.scala
+1 −1 common/shared/src/main/scala/org/specs2/main/SystemProperties.scala
+1 −1 core/jvm/src/test/scala/org/specs2/control/ThrowablexSpec.scala
+1 −1 core/jvm/src/test/scala/org/specs2/reporter/TextPrinterSpec.scala
+1 −1 core/shared/src/main/scala/specs2/run.scala
+3 −6 core/shared/src/test/scala/org/specs2/matcher/TypecheckSpec.scala
+38 −0 examples/jvm/src/test/scala/examples/IntegrationSpec.scala
+15 −0 examples/jvm/src/test/scala/examples/integration/DatabaseIntegrationSpec.scala
+15 −0 examples/jvm/src/test/scala/examples/integration/RemoteServiceIntegrationSpec.scala
+27 −0 examples/jvm/src/test/scala/examples/integration/StartDatabase.scala
+0 −2 examples/shared/src/test/scala/examples/DataTablesSpec.scala
+0 −2 examples/shared/src/test/scala/examples/HelloWorldAutoExamplesSpec.scala
+0 −2 examples/shared/src/test/scala/examples/HelloWorldSpec.scala
+0 −2 examples/shared/src/test/scala/examples/HelloWorldUnitSpec.scala
+0 −2 examples/shared/src/test/scala/examples/ScalaCheckExamplesSpec.scala
+0 −2 examples/shared/src/test/scala/examples/SnippetsScriptSpec.scala
+0 −2 examples/shared/src/test/scala/examples/StackSpec.scala
+1 −1 form/src/main/scala/org/specs2/form/Form.scala
+2 −4 guide/src/test/scala/org/specs2/Website.scala
+2 −2 guide/src/test/scala/org/specs2/guide/Specs2Variables.scala
+5 −2 guide/src/test/scala/org/specs2/guide/matchers/ExceptionMatchers.scala
+1 −1 junit/src/main/scala/org/specs2/reporter/JUnitXmlPrinter.scala
+1 −1 junit/src/main/scala/org/specs2/reporter/ShowDescription.scala
+1 −1 junit/src/main/scala/org/specs2/runner/Specs2TestEngine.scala
+1 −1 markdown/src/main/scala/org/specs2/text/Markdown.scala
+1 −1 matcher/shared/src/main/scala/org/specs2/matcher/EqualityMatcher.scala
+101 −180 matcher/shared/src/main/scala/org/specs2/matcher/ExceptionMatchers.scala
+5 −3 matcher/shared/src/main/scala/org/specs2/matcher/StringMatchers.scala
+23 −4 matcher/shared/src/main/scala/org/specs2/matcher/TryMatchers.scala
+1 −1 project/build.properties
+6 −6 project/depends.scala
+6 −6 project/plugins.sbt
+7 −7 scripts/wordle.scala
+30 −1 tests/jvm/src/test/scala/org/specs2/reporter/SbtPrinterSpec.scala
+82 −49 tests/shared/src/test/scala/org/specs2/matcher/ExceptionMatchersSpec.scala
+1 −1 tests/shared/src/test/scala/org/specs2/matcher/TraversableMatchersSpec.scala
+2 −2 tests/shared/src/test/scala/org/specs2/matcher/TryMatchersSpec.scala
+3 −4 tests/shared/src/test/scala/org/specs2/matcher/describe/DiffablePlusSpec.scala
2 changes: 1 addition & 1 deletion community-build/community-projects/stdLib213
Submodule stdLib213 updated 653 files
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,13 @@ object desugar {
// TODO: drop this once we do not silently insert empty class parameters anymore
case paramss => paramss
}
val finalFlag = if ctx.settings.Yscala2Stdlib.value then EmptyFlags else Final
// implicit wrapper is typechecked in same scope as constructor, so
// we can reuse the constructor parameters; no derived params are needed.
DefDef(
className.toTermName, joinParams(constrTparams, defParamss),
classTypeRef, creatorExpr)
.withMods(companionMods | mods.flags.toTermFlags & (GivenOrImplicit | Inline) | Final)
.withMods(companionMods | mods.flags.toTermFlags & (GivenOrImplicit | Inline) | finalFlag)
.withSpan(cdef.span) :: Nil
}

Expand Down
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ trait TreeInfo[T <: Untyped] { self: Trees.Instance[T] =>
case _ => p(tree)
}

/** The tree stripped of the possibly nested applications (term and type).
* The original tree if it's not an application.
*/
def appliedCore(tree: Tree): Tree = tree match {
case Apply(fn, _) => appliedCore(fn)
case TypeApply(fn, _) => appliedCore(fn)
Expand Down
21 changes: 13 additions & 8 deletions compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,21 @@ object Feature:
if !isExperimentalEnabled then
report.error(em"Experimental $which may only be used with a nightly or snapshot version of the compiler$note", srcPos)

private def ccException(sym: Symbol)(using Context): Boolean =
ccEnabled && defn.ccExperimental.contains(sym)

def checkExperimentalDef(sym: Symbol, srcPos: SrcPos)(using Context) =
if !isExperimentalEnabled then
val symMsg =
if sym.hasAnnotation(defn.ExperimentalAnnot) then
i"$sym is marked @experimental"
else if sym.owner.hasAnnotation(defn.ExperimentalAnnot) then
i"${sym.owner} is marked @experimental"
else
i"$sym inherits @experimental"
report.error(em"$symMsg and therefore may only be used in an experimental scope.", srcPos)
val experimentalSym =
if sym.hasAnnotation(defn.ExperimentalAnnot) then sym
else if sym.owner.hasAnnotation(defn.ExperimentalAnnot) then sym.owner
else NoSymbol
if !ccException(experimentalSym) then
val symMsg =
if experimentalSym.exists
then i"$experimentalSym is marked @experimental"
else i"$sym inherits @experimental"
report.error(em"$symMsg and therefore may only be used in an experimental scope.", srcPos)

/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
def checkExperimentalSettings(using Context): Unit =
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ private sealed trait YSettings:
val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting("-Yno-kind-polymorphism", "Disable kind polymorphism.")
val YexplicitNulls: Setting[Boolean] = BooleanSetting("-Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.")
val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects")
val YcheckInitGlobal: Setting[Boolean] = BooleanSetting("-Ysafe-init-global", "Check safe initialization of global objects")
val YrequireTargetName: Setting[Boolean] = BooleanSetting("-Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation")
val YrecheckTest: Setting[Boolean] = BooleanSetting("-Yrecheck-test", "Run basic rechecking (internal test only)")
val YccDebug: Setting[Boolean] = BooleanSetting("-Ycc-debug", "Used in conjunction with captureChecking language import, debug info for captured references")
Expand All @@ -419,4 +420,3 @@ private sealed trait YSettings:

val YforceInlineWhileTyping: Setting[Boolean] = BooleanSetting("-Yforce-inline-while-typing", "Make non-transparent inline methods inline when typing. Emulates the old inlining behavior of 3.0.0-M3.")
end YSettings

8 changes: 8 additions & 0 deletions compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ trait ConstraintHandling {
*/
protected var canWidenAbstract: Boolean = true

/**
* Used for match type reduction.
* When an abstract type may not be widened, according to `widenAbstractOKFor`,
* we record it in this set, so that we can ultimately fail the reduction, but
* with all the information that comes out from continuing to widen the abstract type.
*/
protected var poisoned: Set[TypeParamRef] = Set.empty

protected var myNecessaryConstraintsOnly = false
/** When collecting the constraints needed for a particular subtyping
* judgment to be true, we sometimes need to approximate the constraint
Expand Down
35 changes: 26 additions & 9 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ class Definitions {
@tu lazy val Caps_unsafeBoxFunArg: Symbol = CapsUnsafeModule.requiredMethod("unsafeBoxFunArg")
@tu lazy val Caps_SealedAnnot: ClassSymbol = requiredClass("scala.caps.Sealed")

@tu lazy val PureClass: Symbol = requiredClass("scala.Pure")

// Annotation base classes
@tu lazy val AnnotationClass: ClassSymbol = requiredClass("scala.annotation.Annotation")
@tu lazy val StaticAnnotationClass: ClassSymbol = requiredClass("scala.annotation.StaticAnnotation")
Expand Down Expand Up @@ -1045,6 +1047,11 @@ class Definitions {

@tu lazy val JavaRepeatableAnnot: ClassSymbol = requiredClass("java.lang.annotation.Repeatable")

// Initialization annotations
@tu lazy val InitModule: Symbol = requiredModule("scala.annotation.init")
@tu lazy val InitWidenAnnot: ClassSymbol = InitModule.requiredClass("widen")
@tu lazy val InitRegionMethod: Symbol = InitModule.requiredMethod("region")

// A list of meta-annotations that are relevant for fields and accessors
@tu lazy val NonBeanMetaAnnots: Set[Symbol] =
Set(FieldMetaAnnot, GetterMetaAnnot, ParamMetaAnnot, SetterMetaAnnot, CompanionClassMetaAnnot, CompanionMethodMetaAnnot)
Expand Down Expand Up @@ -1944,6 +1951,14 @@ class Definitions {
case Some(pkgs) => pkgs.contains(sym.owner)
case none => false

/** Experimental definitions that can nevertheless be accessed from a stable
* compiler if capture checking is enabled.
*/
@tu lazy val ccExperimental: Set[Symbol] = Set(
CapsModule, CapsModule.moduleClass, PureClass,
CapabilityAnnot, RequiresCapabilityAnnot,
RetainsAnnot, RetainsByNameAnnot, WithPureFunsAnnot)

// ----- primitive value class machinery ------------------------------------------

class PerRun[T](generate: Context ?=> T) {
Expand Down Expand Up @@ -2041,15 +2056,17 @@ class Definitions {
def isValueSubClass(sym1: Symbol, sym2: Symbol): Boolean =
valueTypeEnc(sym2.asClass.name) % valueTypeEnc(sym1.asClass.name) == 0

@tu lazy val specialErasure: SimpleIdentityMap[Symbol, ClassSymbol] =
SimpleIdentityMap.empty[Symbol]
.updated(AnyClass, ObjectClass)
.updated(MatchableClass, ObjectClass)
.updated(AnyValClass, ObjectClass)
.updated(SingletonClass, ObjectClass)
.updated(TupleClass, ProductClass)
.updated(NonEmptyTupleClass, ProductClass)
.updated(PairClass, ObjectClass)
@tu lazy val specialErasure: collection.Map[Symbol, ClassSymbol] =
val m = mutable.Map[Symbol, ClassSymbol]()
m(AnyClass) = ObjectClass
m(MatchableClass) = ObjectClass
m(PureClass) = ObjectClass
m(AnyValClass) = ObjectClass
m(SingletonClass) = ObjectClass
m(TupleClass) = ProductClass
m(NonEmptyTupleClass) = ProductClass
m(PairClass) = ObjectClass
m

// ----- Initialization ---------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ object Symbols {
ctx.settings.YretainTrees.value ||
denot.owner.isTerm || // no risk of leaking memory after a run for these
denot.isOneOf(InlineOrProxy) || // need to keep inline info
ctx.settings.YcheckInit.value // initialization check
ctx.settings.YcheckInit.value || // initialization check
ctx.settings.YcheckInitGlobal.value

/** The last denotation of this symbol */
private var lastDenot: SymDenotation = _
Expand Down
Loading

0 comments on commit 10c9af0

Please sign in to comment.