Skip to content
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

Backport "fix regression: inline match crash when rhs uses private inlined methods" to LTS #20621

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
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/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ object Trees {
val point = span.point
if name.toTermName == nme.ERROR then
Span(point)
else if qualifier.span.start > span.point then // right associative
else if qualifier.span.exists && qualifier.span.start > span.point then // right associative
val realName = name.stripModuleClassSuffix.lastPart
Span(span.start, span.start + realName.length, point)
else
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CompilationTests {
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")),
compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")),
compileDir("tests/pos-special/i18589", defaultOptions.and("-Ysafe-init").without("-Ycheck:all")),
// Run tests for legacy lazy vals
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
Expand Down
17 changes: 17 additions & 0 deletions tests/pos-special/i18589/core_0.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import scala.deriving.Mirror

trait NamedCodec[A, R]

object NamedCodecPlatform {

final class Builder[R]() {
inline def of[T](using m: Mirror.Of[T]): NamedCodec[T, R] =
inline m match {
case s: Mirror.SumOf[T] => sumInst(s)
case _: Mirror.ProductOf[T] => productInst
}

private inline def productInst[T]: NamedCodec[T, R] = ???
private inline def sumInst[T](m: Mirror.SumOf[T]): NamedCodec[T, R] = ???
}
}
8 changes: 8 additions & 0 deletions tests/pos-special/i18589/test_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum Data {
case A, B, C
}

@main def Test = {
val builder: NamedCodecPlatform.Builder[Any] = ???
builder.of[Data]
}
Loading