From 6eb78e8572f2cb8fe02934e77d9f222a8ff68121 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 18 Apr 2019 18:16:31 +0200 Subject: [PATCH 1/3] Only allow to set uniqueId from positioned --- compiler/src/dotty/tools/dotc/ast/Positioned.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 0890e22a9aa2..63f7024a8eb6 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -23,7 +23,7 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro */ def uniqueId: Int = myUniqueId - def uniqueId_=(id: Int): Unit = { + private def uniqueId_=(id: Int): Unit = { //assert(id != 2523, this) myUniqueId = id } From cadb4de89ed9c976029168dfe3ff1615fa7b05b3 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 18 Apr 2019 18:18:22 +0200 Subject: [PATCH 2/3] Add alternative possition tracking template When there is the need to recompile the Dotty library the assertion may fail. --- compiler/src/dotty/tools/dotc/ast/Positioned.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 63f7024a8eb6..7c102cfc4a08 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -25,6 +25,7 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro private def uniqueId_=(id: Int): Unit = { //assert(id != 2523, this) + // if (id == 1234) new Throwable().printStackTrace() myUniqueId = id } From 4164ba21d4d3c643d55adcf151aed443756447ce Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 23 Apr 2019 13:42:19 +0200 Subject: [PATCH 3/3] Add comment --- compiler/src/dotty/tools/dotc/ast/Positioned.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 7c102cfc4a08..91d854ca20cd 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -24,8 +24,10 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro def uniqueId: Int = myUniqueId private def uniqueId_=(id: Int): Unit = { - //assert(id != 2523, this) + // FOR DEBUGGING + // assert(id != 2523, this) // if (id == 1234) new Throwable().printStackTrace() + myUniqueId = id }