Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

WojciechMazur
Copy link
Contributor

No description provided.

sjrd and others added 30 commits July 13, 2025 20:33
)

VCInlineMethods needed to be extended to this case.

Fixes scala#23266

Also rename previous i23266.scala to i23299.scala to reflect the proper
issue for it.
This reverts commit 6d0f9ca.

Forward port of most commits in
scala/scala#8037

Compensate some of the consequences by adding the `MixedIn` flag.
In addition to the use seen in the diff in `BCodeHelpers`, the JS
backend has an existing test for `isOneOf(Bridge | MixedIn)` which
needs this compensation.
This is a forward port of
scala/scala@6fc2202
In Scala 2 that commit was reverting a commit that had stopped
emitting Java generic signatures. In dotc we never had that logic
before, so this is new code.
Before merging the history of the scala 2 library with Dotty, we first
pin the set of files to be compiled for now.
This will change in 3.8.0 when we bundle all the files of the scala 3
library in the same jar and drop the dependency to scala2 stdlib

[test_non_bootstrapped]
Needed to break the loop between completion of class and companion
object. If we try to complete the class first, and completion needs the
companion object (for instance for processing an import) then the
companion object completion would consult the companion class info for
constructor that need a constructor proxy in the object. This can lead
to a cyclic reference.

We now break the cycle by delaying adding constructor proxies in this
case to be the last completion action of the companion class.
Until `3.8.0`, and because we are pinning the files for the scala 3 lib,
we add a `CODEOWNERS` so that GitHub can notify us in case a PR changes
the stdlib. This way, we can make sure that the PR doesn't go against
the spirit of pinning the files and that its intentions are actually
fulfilled.

[skip ci]
scala#23518)

Follows scala#23517

The compiler adds the `sourceDirectories` as an option so that it can
load the definitions from the stdlib.
Now, instead of adding the directories, we just add the pinned files.

This has been missing when I merged locally the scala 2 history. With
this change, everything behaves as expected when I opened scala#23517.
The new scheme works also if argument trees are not unique. Instead of storing
skolem types directly in attachment of arguments, we store a map from arguments
to their skolems in the enclosing application node. But we check then that the
same argument tree does not appear several times in an application. If it does
appear several times, we don't generate the map.

Furthermore, we are also safe if the whole application tree is used several times,
since for each call we generate new skolems and store them in the map. So different
calls get different skolems.
…tive match checking (scala#23403)

1. If the field with bottom type is `lazy`, then the constructor is
inhabited.
2. Now it is taken into account that the type member can be `Nothing`
and the field can be this type member.
3. The check has been moved to the `inhabited` function, allowing some
changes to be reverted from scala#21750

I was also thinking about making the check recursive, i.e. checking that
all fields are inhabited. This could cause problems with cycles and
performance, so I'm not sure whether to do it.
Fixes scala#23494 

When inspecting unused implicit parameters, the check skips parameters
which are "marker traits". It tests for any members of the type (or its
upper bound) which are not "universal members". This commit uses the
`resultType` to avoid an error
```
invalid new prefix
```
while computing members where the type is a `LambdaType`.

A future improvement would be not to request `allMembers`, since the
check only needs to find one that is not universal.

The necessitating change was
scala@2e4bc0a.
…cala#23506)

Don't force completion of annotation unpickling when testing for
SilentIntoAnnot

Fixes scala#23496
To be able to merge scala#23522, we need to make some adjustments to the
tests and undo them later when the stdlib will be fully independent of
scala 2.

[skip ci]
No more Java style conditionals and loops. Always requires then/do.

Also: Enforce latest given syntax, instead of the intermediate one. The
two were rolled into one PR because they require changing the same
submodules.
To explain what was happening and what the issue was:
Minimalisation:
```scala
import scala.quoted.*

package jam {
  trait JamCoreDsl {
    implicit inline def defaultJamConfig: this.JamConfig =
      new JamConfig(brewRecRegex = ".*")
    class JamConfig(val brewRecRegex: String)
    inline def brew(implicit inline config: JamConfig): Unit = ???
  }
  private object internal extends JamCoreDsl
  export internal._
}

object test {
  jam.brew
}
```
would fail retyping in the inlining phase.

During typer, because we were exporting contents of `Internal`, the
compiler created forwarders (in Namer.addForwarder) for methods chosen
in the export. The forwarders looked like this:
```scala
      final implicit inline def defaultJamConfig: jam.internal.JamConfig =
        jam.Internal.defaultJamConfig
      final inline def brew(implicit inline config: jam.internal.JamConfig):
        Unit = jam.Internal.brew(config)
```
While creating them, the compiler would also try to type them. Because
those forwarder methods were inline, the compiler would call
PrepareInlineable.makeInlineable on them. That method would transform
rhs of the forwarder method, to make sure it does not reference any
private methods/objects. Since `Internal` is private (and referenced in
both exported methods, notably in brew with rhs
jam.Internal.brew(config)), an accessor inline$Internal was created, and
the forwarder method contents remapped.

Then, during inlining in the inline phase, the ReTyper was not able to
type `jam.inline$internal.brew(config)`, with `jam.inline$internal.brew`
being typed as `Nothing => Unit` (likely having remapped the argument to
Nothing in an asSeenFrom, after deciding that the prefix is not stable).

But none of this happened when I created those forwarders and accessors
manually. After some digging it turned out that the `inline$internal`
accessor method was typed as `TypeRef(ThisType(TypeRef(NoPrefix,module
class jam)),module class internal$))`, but the manually created one was
a `TermRef(ThisType(TypeRef(NoPrefix,module class jam)), object
Internal)`. It seems like the first one has an unstable prefix, so its
denotation is not typed correctly, leading to the issue.
Fixes scala#22593
Since we will force erased expressions to be pure values, they are always
initialized.
Gedochao and others added 30 commits August 11, 2025 22:27
We now use a blend of the new scheme and backwards compatible special case if type variables
as ClassTag arguments are constrained by further type variables.

Fixes scala#23611

[Cherry-picked b677f97]
After an "implicit not found", we type additional arguments to get more context which might
give a larger implicit scope to search. With this commit we do that only if there is no
default argument for the implicit.

This might fix scala#23610

[Cherry-picked 975c988]
We now use a blend of the new scheme and a backwards compatible special
case if type variables as ClassTag arguments are constrained by further
type variables.

Fixes scala#23611
[Cherry-picked cfaa5d3]
Fixes scala#23651 

The [previous fix](scala#22383) for the
same `@nowarn` attached to multiple elements should have compared the
`annotPos` to identify duplicates (instead of the target range).

This commit defers detecting "bad" or duplicate suppressions (which
originate with the same annotation) to report time, after the
suppression is "unused"; there are few nowarns per file and fewer that
are unused.

While checking for a suppression, mark matching unused suppressions as
"superseded", so that if they remain unused, the warning can add an
"audit" that the nowarn matched a diagnostic (but was superseded by some
other nowarn).

~This commit goes further and checks for duplicates (including whether
the filters look the same).~

~If it finds a duplicate where the `annotPos` differs, warn about the
user-written annotation.~

~Filters match each other if they are the same type and, if they have a
pattern, the string representations of the patterns are equal.~
[Cherry-picked 40843f7]
-Wrecurse-with-default warns on self-recursion with default arg.

[Cherry-picked 6dac167]
Backports scala#23702 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
…ument" to 3.7.3 (scala#23713)

Backports scala#23664 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
Backports scala#23659 to the 3.7.3-RC1.

PR submitted by the release tooling.
[skip ci]
Backports scala#23652 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
…dynamic select hovers" to 3.7.3 (scala#23716)

Backports scala#23640 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
… due to Named Tuple :* syntax" to 3.7.3 (scala#23717)

Backports scala#23602 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
Backports scala#23559 to the 3.7.3-RC2.

PR submitted by the release tooling.
…eOf (scala#23708)

We recently started having issues when running completions in metals,
with the presentation compiler crashing:
```scala
dotty.tools.dotc.core.TypeError$.apply(TypeErrors.scala:54)
	dotty.tools.dotc.core.Denotations$MultiDenotation.suchThat(Denotations.scala:1280)
	dotty.tools.dotc.core.Denotations$Denotation.requiredSymbol(Denotations.scala:305)
	dotty.tools.dotc.core.Denotations$Denotation.requiredMethod(Denotations.scala:321)
	dotty.tools.pc.completions.Completions.isUninterestingSymbol$lzyINIT1(Completions.scala:744)
	dotty.tools.pc.completions.Completions.isUninterestingSymbol(Completions.scala:725)
	dotty.tools.pc.completions.Completions.includeSymbol(Completions.scala:90)
	dotty.tools.pc.completions.Completions.visit$3(Completions.scala:697)
	dotty.tools.pc.completions.Completions.filterInteresting$$anonfun$1(Completions.scala:715)
	scala.collection.immutable.List.foreach(List.scala:334)
	dotty.tools.pc.completions.Completions.filterInteresting(Completions.scala:715)
	dotty.tools.pc.completions.Completions.enrichedCompilerCompletions(Completions.scala:118)
	dotty.tools.pc.completions.Completions.completions(Completions.scala:136)
	dotty.tools.pc.completions.CompletionProvider.completions(CompletionProvider.scala:139)
	dotty.tools.pc.ScalaPresentationCompiler.complete$$anonfun$1(ScalaPresentationCompiler.scala:194)


dotty.tools.dotc.core.TypeError$$anon$1: Failure to disambiguate overloaded reference with
  method valueOf in object Predef: [T]: T  and
  method valueOf in object Predef: [T](implicit vt: ValueOf[T]): T
```
This happened after the recent changes to the stdlib, with the, I
believe, newly added valueOf overload, and the previously used
`requiredMethod` by design not handling these cases.

I also noticed that in the same piece of code we had a bit of an empty
Symbol factory situation going on, with MultiDenotation being changed
into a Symbol (always resulting in an empty symbol), and only later
flattened with the `alternatives`, so I changed that too.

I can't really test this properly, as the pc tests seem to use an older
stdlib, but at least the `wait` methods do resolve properly after these
changes, so I have no reason to think the valueOf methods would be any
different.
[Cherry-picked 1b5e93b]
…oaded valueOf" to 3.7.3 (scala#23724)

Backports scala#23708 to the 3.7.3-RC2.

PR submitted by the release tooling.
[skip ci]
Backports scala#23695 to the 3.7.3-RC2.

PR submitted by the release tooling.
…ala#23861)

Backports scala#23856 to the 3.7.3-RC3.

PR submitted by the release tooling.
Signed-off-by: Wojciech Mazur <[email protected]>
Signed-off-by: Wojciech Mazur <[email protected]>
Signed-off-by: Wojciech Mazur <[email protected]>
Signed-off-by: Wojciech Mazur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.