-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Sync with the stable documentation branch #23120
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This implements the change proposed in scala/improvement-proposals#84. The added pos test case presents motivating examples, the added neg test cases demonstrate that errors are correctly reported when cycles are present. The potential for cycle is no worse than with the existing extraction logic as demonstrated by the existing test in `tests/neg/mt-deskolemize.scala`. [Cherry-picked 1a235c6]
This way we can merge this PR without waiting for the SIP committee to approve it. [Cherry-picked 61b5a7b][modified]
No need to save the value of `refersToSkolem`: if it's true before we enter `NamedType` it will be true after and `dropSkolem` will return `NoType`. The previous logic could still be useful if we want to give more easily actionable error messages in the future by only keeping in the type the skolems we couldn't remove. [Cherry-picked a1930c4]
…g implicit Context (#20330) We do deprecate `StandardPlugin.init` in favour of `StandardPlugin.initialize` method tak takes additional `Context` parameter - it would e.g. allow to use reporting mechanism when parsing compiler plugin options. Introduces changes to akka/akka fork used in Community Build [Cherry-picked 1276034]
[Cherry-picked 34f17b7]
[Cherry-picked 31c9e8a]
The rules for export forwarders are changed as follows. Previously, all export forwarders were declared `final`. Now, only term members are declared `final`. Type aliases left aside. This makes it possible to export the same type member into several traits and then mix these traits in the same class. `typeclass-aggregates.scala` shows why this is essential to be able to combine multiple givens with type members. The change does not lose safety since different type aliases would in any case lead to uninstantiatable classes. [Cherry-picked 84655ca][modified]
Refinements of a class parent are added as synthetic members to the inheriting class. [Cherry-picked 4894414]
For a tracked class parameter we add a refinement in the constructor type that the class member is the same as the parameter. E.g. ```scala class C { type T } class D(tracked val x: C) { type T = x.T } ``` This will generate the constructor type: ```scala (x1: C): D { val x: x1.type } ``` Without `tracked` the refinement would not be added. This can solve several problems with dependent class types where previously we lost track of type dependencies. [Cherry-picked 5189e68]
Allow the RHS of a type def to be higher-kinded. But keep the restriction for opaque type aliases; their RHS must be fully applied. I am not sure why the restriction applies to them, but there was a test specifically about that, so there night be a reason. # Conflicts: # compiler/src/dotty/tools/dotc/typer/Typer.scala # Conflicts: # compiler/src/dotty/tools/dotc/typer/Typer.scala # tests/pos/typeclasses-this.scala [Cherry-picked f96a769]
A type implemented in a given definition can now be an infix type, without enclosing parens being necessary. By contrast, it cannot anymore be a refined type. Refined types have to be enclosed in parens. This second point aligns the dotty parser with the published syntax and the scala meta parser. # Conflicts: # tests/pos/typeclasses-this.scala [Cherry-picked ef71dcb]
given [A: Ord] => A is Ord: ... given [A: Ord] => A is Ord as listOrd: ... [Cherry-picked 2f58cbc]
[Cherry-picked 598c6ad]
Also, provide the possibility to use the parameter name for single context bounds. This is controlled by a Config setting, which is off by default. [Cherry-picked a61d2bc]
A definition like `given T = deferred` in a trait will be expanded to an abstract given in the trait that is implemented automatically in all classes inheriting the trait. [Cherry-picked b48fb99]
Also, fix the unmangling of UniqueExtNames, which seemingly never worked. [Cherry-picked 600293e]
Consider the following program: ```scala class A class B extends A class C extends A given A = A() given B = B() given C = C() def f(using a: A, b: B, c: C) = println(a.getClass) println(b.getClass) println(c.getClass) @main def Test = f ``` With the current rules, this would fail with an ambiguity error between B and C when trying to synthesize the A parameter. This is a problem without an easy remedy. We can fix this problem by flipping the priority for implicit arguments. Instead of requiring an argument to be most _specific_, we now require it to be most _general_ while still conforming to the formal parameter. There are three justifications for this change, which at first glance seems quite drastic: - It gives us a natural way to deal with inheritance triangles like the one in the code above. Such triangles are quite common. - Intuitively, we want to get the closest possible match between required formal parameter type and synthetisized argument. The "most general" rule provides that. - We already do a crucial part of this. Namely, with current rules we interpolate all type variables in an implicit argument downwards, no matter what their variance is. This makes no sense in theory, but solves hairy problems with contravariant typeclasses like `Comparable`. Instead of this hack, we now do something more principled, by flipping the direction everywhere, preferring general over specific, instead of just flipping contravariant type parameters. The behavior is dependent on the Scala version - Old behavior: up to 3.4 - New behavior: from 3.5, 3.5-migration warns on behavior change The CB builds under the new rules. One fix was needed for a shapeless 3 deriving test. There was a typo: mkInstances instead of mkProductInstances, which previously got healed by accident because of the most specific rule. Also: Don't flip contravariant type arguments for overloading resolution Flipping contravariant type arguments was needed for implicit search where it will be replaced by a more general scheme. But it makes no sense for overloading resolution. For overloading resolution, we want to pick the most specific alternative, analogous to us picking the most specific instantiation when we force a fully defined type. Also: Disable implicit search everywhere for disambiaguation Previously, one disambiguation step missed that, whereas implicits were turned off everywhere else. [Cherry-picked 48000ee]
Expand them to deferred givens [Cherry-picked d923cac]
Make context bound evidence params tracked if they have types with abstract type members. [Cherry-picked 4d62692]
We already reduce `R { type A = T } # A` to `T` in most situations when we create types. We now also reduce `R { val x: S } # x` to `S` if `S` is a singleton type. This will simplify types as we go to more term-dependent typing. As a concrete benefit, it will avoid several test-pickling failures due to pickling differences when using dependent types. [Cherry-picked 96fbf29]
[Cherry-picked ce09ef3]
If a context bound type `T` for type parameter `A` does not have type parameters, demand evidence of type `T { type Self = A }` instead. [Cherry-picked c6388c2]
[Cherry-picked f444b46]
Allow to constrain type variables to be singletons by a context bound [X: Singleton] instead of an unsound supertype [X <: Singleton]. This fixes the soundness hole of singletons. [Cherry-picked f713652]
Backports #22843 to the 3.7.0-RC2. PR submitted by the release tooling.
) Backports #22815 to the 3.7.0-RC2. PR submitted by the release tooling.
Backports #22814 to the 3.7.0-RC2. PR submitted by the release tooling.
…in 3.7.0 (#22940) This reverts #21744 in 3.7.0-RC2 as per #22713 (comment) discussion
Check trailing blank line at EOF for OUTDENT If EOF is preceded by only spaces on the last line, do not outdent because it will complain about alignment during an edit. Preserve EOF token when probing arrow EOL For REPL, `: x =>` at EOF sees an EOF in order to detect lambda eol.
) Backports #22855 to 3.7.0-RC2
Make `scala.caps` a package instead of an object. The following are still under `scala.caps`, while staying `@experimental`: - The Capability trait, which will be stable in near future - The universal capture reference `cap` -- **now an object**. - The carrier trait for capture set parameters `CapSet` - The `Contains` trait: - Due to `given`s cannot be marked `@experimental`, an experimental `Contains` object was created instead, which contains the `containsImpl` given. - Exclusive capabilities annotations: `Mutable`, `SharedCapability` and `consume` - The _`Exists`_ trait is marked `deprecated`, but is required to build the current version of the compiler. It should be removed in the next version. - The `unsafe` object: - `untrackedCaptures` is moved into `caps.unsafe`. - Deprecated aliases `*` and `Cap` are **removed** The following are moved under the experimental `scala.caps.internal` object: - `capsOf` - `rootCapability`, `reachCapability` and `readOnlyCapability` - `refineOverride` Add documentation for `Capability` and some other experimental annotations. Tests are updated accordingly.
`scala.caps`` was an object until 3.6, it is a package from 3.7. Without special handling this would cause a TypeError to be thrown if a build has several versions of the Scala standard library on the classpath. This was the case for 29 projects in the open CB. These projects should be updated. But until that's the case we issue a warning instead of a hard failure.
1. Fix translation for named patterns where the selector is a single-element named tuple. We used to take the whole tuple as result (which is correct for unnamed patterns) but for named patterns we have to select the field instead. 2. Take account of named patterns in the refutability check. [Cherry-picked cb97658]
[Cherry-picked ca80310]
Backports #22953 to the 3.7.0-RC2. PR submitted by the release tooling.
That is the commit that removed calls to `withStrictFloats(true)`, which have been the default since 1.9.0, and cannot be changed since 1.19.0. [Cherry-picked bac43a7]
With minimal changes to preserve the status quo. These are forward ports of compiler, library and build changes from the following upstream commits: * scala-js/scala-js@b38201c Drop support for non-strict floats. * scala-js/scala-js@82910a0 Move well-known names to a new object `WellKnownNames`. * scala-js/scala-js@53dc4fe Introduce `NewLambda` to synthesize instances of SAM types. * scala-js/scala-js@9481522 Rewrite old IR with `AnonFunctionN` references to use `NewLambda`. From the `NewLambda` commit, we only adapt the way we compile Scala function lambdas. We do not use `NewLambda` for arbitrary SAM types yet. This is left for a future, independent commit, as it is not required for correctness.
With minimal changes to preserve the status quo. These are forward ports of compiler, library and build changes from the following upstream commits: * scala-js/scala-js@b38201c Drop support for non-strict floats. * scala-js/scala-js@82910a0 Move well-known names to a new object `WellKnownNames`. * scala-js/scala-js@53dc4fe Introduce `NewLambda` to synthesize instances of SAM types. * scala-js/scala-js@9481522 Rewrite old IR with `AnonFunctionN` references to use `NewLambda`. From the `NewLambda` commit, we only adapt the way we compile Scala function lambdas. We do not use `NewLambda` for arbitrary SAM types yet. This is left for a future, independent commit, as it is not required for correctness. [Cherry-picked 12ca458][modified]
Backports #23026 to the 3.7.0-RC3. PR submitted by the release tooling.
…23117) Synchronizes `language-reference-stable` after releaase 3.7.0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is syncing the main with changes from language-reference-stable.
It was created automatically after d53b097 by @WojciechMazur