-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
scala.MatchError dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:798) #19202
Comments
Still crashes as of 3.4.0-RC1-bin-20240112-c50f2ff-NIGHTLY-git-c50f2ff. |
This issue was picked for the Issue Spree No. 41 of January 16th, 2024 which takes place in 2 days. @smarter, @jan-pieter, @nmcb will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
Some observations:
|
It does also work if the case class is replaced by a def: class Test {
def test(s: String): Unit = {
if (s == null) {
return
}
def g() = ()
}
} |
Interesting. The difference there is that the case class and the result gets wrapped in a block: sbt:scala3> scalac -Xprint:parser tests/pos/i19202.scala
[[syntax trees at end of parser]] // tests/pos/i19202.scala
package <empty> {
class Test {
def test(s: String): Unit =
{
if (s == null)
{
return
}
{
case class XXX() {}
<empty>
}
}
}
} Without curly braces: sbt:scala3> scalac -Xprint:parser tests/pos/i19202.scala
[[syntax trees at end of parser]] // tests/pos/i19202.scala
package <empty> {
class Test {
def test(s: String): Unit =
{
if (s == null)
{
return
}
case class XXX() {}
<empty>
}
}
}
... |
The exception is a |
@noti0na1 will join you to work on this issue. |
Turns out the match fails on a |
…eter (#19463) Fix #19202 by passing latest `NotNullInfos` to a mutable field of a `Completer`. Completing a `Def` requires the new NotNullInfos from previous statements. Originally, we created a new Completer with the new creation ctx in `adaptCreationContext`. However, we should not create a regular Completer for `TypeDef`s. This PR fixes the issue by creating a mutable field for NotNullInfos in Completer, and the field is updated in `adaptCreationContext` now.
Compiling a minimized example with scala 3.3.1:
results in
The text was updated successfully, but these errors were encountered: