Skip to content

Fix #11885: Always clone trees if position already set #11960

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

Merged
merged 1 commit into from
May 25, 2021
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
9 changes: 4 additions & 5 deletions compiler/src/dotty/tools/dotc/ast/Positioned.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
if (span == mySpan) this
else {
val newpd: this.type =
if (mySpan.isSynthetic) {
if (!mySpan.exists && span.exists)
envelope(source, span.startPos) // fill in children spans
if !mySpan.exists then
if span.exists then envelope(source, span.startPos) // fill in children spans
this
}
else cloneIn(source)
else
cloneIn(source)
newpd.span = span
newpd
}
Expand Down
5 changes: 2 additions & 3 deletions compiler/test/dotty/tools/dotc/IdempotencyTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ class IdempotencyTests {
import IdempotencyTests._
import CompilationTest.aggregateTests

// Flaky test on Windows
// https://github.com/lampepfl/dotty/issues/11885
val filter = FileFilter.exclude("i6507b.scala")
// ignore flaky tests
val filter = FileFilter.NoFilter

@Category(Array(classOf[SlowTests]))
@Test def idempotency: Unit = {
Expand Down