From d95502011a8601214e43ee0414a8e36be6ea57b8 Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Fri, 11 Apr 2025 11:45:19 +0200 Subject: [PATCH 01/11] Experiment with simpler inference for tracked --- .../src/dotty/tools/dotc/config/Feature.scala | 2 +- compiler/src/dotty/tools/dotc/typer/Namer.scala | 16 ++++++++++------ tests/pos/tracked.scala | 6 ++++++ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 tests/pos/tracked.scala diff --git a/compiler/src/dotty/tools/dotc/config/Feature.scala b/compiler/src/dotty/tools/dotc/config/Feature.scala index 6eaa4d5c98a3..fa8d2cdc13f1 100644 --- a/compiler/src/dotty/tools/dotc/config/Feature.scala +++ b/compiler/src/dotty/tools/dotc/config/Feature.scala @@ -112,7 +112,7 @@ object Feature: * feature is defined. */ def enabled(feature: TermName)(using Context): Boolean = - enabledBySetting(feature) || enabledByImport(feature) + enabledBySetting(feature) || enabledByImport(feature) || feature == modularity /** Is auto-tupling enabled? */ def autoTuplingEnabled(using Context): Boolean = !enabled(nme.noAutoTupling) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 65c9fa2f5ddc..e32af8691fb4 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -2039,12 +2039,10 @@ class Namer { typer: Typer => lazy val isRefInSignatures = psym.maybeOwner.isPrimaryConstructor && isReferencedInPublicSignatures(psym) + lazy val needsTrackedSimp = needsTrackedSimple(psym, param, owningSym) !psym.is(Tracked) && psym.isTerm - && ( - abstractContextBound - || isRefInSignatures - ) + && needsTrackedSimp /** Under x.modularity, we add `tracked` to context bound witnesses and * explicit evidence parameters that have abstract type members @@ -2055,6 +2053,13 @@ class Namer { typer: Typer => && (param.hasAttachment(ContextBoundParam) || (psym.isOneOf(GivenOrImplicit) && !accessorSyms.forall(_.isOneOf(PrivateLocal)))) && psym.info.memberNames(abstractTypeNameFilter).nonEmpty + private def needsTrackedSimple(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context): Boolean = + val accessorSyms = maybeParamAccessors(owningSym, psym) + (owningSym.isClass || owningSym.isAllOf(Given | Method)) + && !accessorSyms.exists(_.is(Mutable)) + && (param.hasAttachment(ContextBoundParam) || !accessorSyms.forall(_.isOneOf(PrivateLocal))) + && psym.info.memberNames(abstractTypeNameFilter).nonEmpty + extension (sym: Symbol) private def infoWithForceNonInferingCompleter(using Context): Type = sym.infoOrCompleter match case tpe: LazyType if tpe.isExplicit => sym.info @@ -2102,8 +2107,7 @@ class Namer { typer: Typer => def setTrackedConstrParam(param: ValDef)(using Context): Unit = val sym = symbolOfTree(param) sym.maybeOwner.maybeOwner.infoOrCompleter match - case info: ClassInfo - if !sym.is(Tracked) && isContextBoundWitnessWithAbstractMembers(sym, param, sym.maybeOwner.maybeOwner) => + case info: ClassInfo if needsTracked(sym, param, sym.maybeOwner.maybeOwner) => typr.println(i"set tracked $param, $sym: ${sym.info} containing ${sym.info.memberNames(abstractTypeNameFilter).toList}") setParamTrackedWithAccessors(sym, info) case _ => diff --git a/tests/pos/tracked.scala b/tests/pos/tracked.scala new file mode 100644 index 000000000000..0933593a98d8 --- /dev/null +++ b/tests/pos/tracked.scala @@ -0,0 +1,6 @@ +import scala.language.experimental.modularity + +trait T: + type X + +class C(var t: T) From 99af3f5cc33e9be4eda69a1a02ed41a6e80529ad Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Tue, 22 Apr 2025 11:41:29 +0200 Subject: [PATCH 02/11] WIP notes and stuff --- after-printing.txt | 151 ++++++ .../src/dotty/tools/dotc/typer/Namer.scala | 51 +- .../src/dotty/tools/dotc/typer/Typer.scala | 1 + simple-tracked-inference-failures-clean.md | 329 ++++++++++++ simple-tracked-inference-failures-edited.md | 388 ++++++++++++++ simple-tracked-inference-failures.md | 492 ++++++++++++++++++ tasty-fail-diff.txt | 187 +++++++ tests/pos/i2997.scala | 20 +- 8 files changed, 1568 insertions(+), 51 deletions(-) create mode 100644 after-printing.txt create mode 100644 simple-tracked-inference-failures-clean.md create mode 100644 simple-tracked-inference-failures-edited.md create mode 100644 simple-tracked-inference-failures.md create mode 100644 tasty-fail-diff.txt diff --git a/after-printing.txt b/after-printing.txt new file mode 100644 index 000000000000..90cfcf8e9544 --- /dev/null +++ b/after-printing.txt @@ -0,0 +1,151 @@ +Header: + version: + tooling: + UUID: + +Names (351 bytes, starting from ): + 0: ASTs + 1: + 2: scala + 3: reflect + 4: scala[Qualified . reflect] + 5: ClassTag + 6: Foo + 7: + 8: java + 9: lang + 10: java[Qualified . lang] + 11: Object + 12: java[Qualified . lang][Qualified . Object] + 13: [Signed Signature(List(),java.lang.Object) @] + 14: Unit + 15: mkArray + 16: T + 17: Nothing + 18: Any + 19: WitnessNames + 20: annotation + 21: scala[Qualified . annotation] + 22: internal + 23: scala[Qualified . annotation][Qualified . internal] + 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] + 25: collection + 26: scala[Qualified . collection] + 27: immutable + 28: scala[Qualified . collection][Qualified . immutable] + 29: Seq + 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] + 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] + 32: String + 33: evidence$1 + 34: evidence$ + 35: [Unique evidence$ 1] + 36: ??? + 37: Predef + 38: SourceFile + 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] + 40: java[Qualified . lang][Qualified . String] + 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] + 42: + 43: Positions + 44: Comments + 45: Attributes + +Trees (122 bytes, starting from ): + 0: PACKAGE(120) + 2: TERMREFpkg 1 [] + 4: IMPORT(4) + 6: TERMREFpkg 4 [scala[Qualified . reflect]] + 8: IMPORTED 5 [ClassTag] + 10: TYPEDEF(110) 6 [Foo] + 13: TEMPLATE(89) + 15: APPLY(10) + 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] + 20: NEW + 21: TYPEREF 11 [Object] + 23: TERMREFpkg 10 [java[Qualified . lang]] + 25: SHAREDtype 21 + 27: DEFDEF(7) 7 [] + 30: EMPTYCLAUSE + 31: TYPEREF 14 [Unit] + 33: TERMREFpkg 2 [scala] + 35: STABLE + 36: DEFDEF(66) 15 [mkArray] + 39: TYPEPARAM(35) 16 [T] + 42: TYPEBOUNDStpt(8) + 44: TYPEREF 17 [Nothing] + 46: SHAREDtype 33 + 48: TYPEREF 18 [Any] + 50: SHAREDtype 33 + 52: ANNOTATION(22) + 54: TYPEREF 19 [WitnessNames] + 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] + 58: APPLY(16) + 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] + 63: NEW + 64: SHAREDtype 54 + 66: SHAREDtype 54 + 68: REPEATED(6) + 70: TYPEREF 32 [String] + 72: SHAREDtype 23 + 74: STRINGconst 33 [evidence$1] + 76: PARAM(14) 35 [[Unique evidence$ 1]] + 79: APPLIEDtpt(10) + 81: IDENTtpt 5 [ClassTag] + 83: TYPEREF 5 [ClassTag] + 85: SHAREDtype 6 + 87: IDENTtpt 16 [T] + 89: TYPEREFdirect 39 + 91: GIVEN + 92: IDENTtpt 17 [Nothing] + 94: TYPEREF 17 [Nothing] + 96: TERMREFpkg 2 [scala] + 98: TERMREF 36 [???] + 100: TERMREF 37 [Predef] + 102: SHAREDtype 33 + 104: ANNOTATION(16) + 106: TYPEREF 38 [SourceFile] + 108: SHAREDtype 56 + 110: APPLY(10) + 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] + 115: NEW + 116: SHAREDtype 106 + 118: SHAREDtype 106 + 120: STRINGconst 42 [] + 122: + +Positions (83 bytes, starting from ): + lines: 7 + line sizes: + 38, 0, 23, 0, 10, 41, 0 + positions: + 0: 40 .. 117 + 4: 40 .. 63 + 6: 47 .. 54 + 8: 55 .. 63 + 10: 65 .. 117 + 13: 78 .. 117 + 21: 71 .. 71 + 27: 78 .. 78 + 31: 78 .. 78 + 36: 78 .. 117 + 39: 90 .. 101 + 44: 93 .. 93 + 48: 93 .. 93 + 64: 90 .. 90 + 70: 90 .. 90 + 74: 90 .. 90 + 76: 93 .. 101 + 81: 93 .. 101 + 87: 93 .. 101 + 92: 104 .. 111 + 98: 114 .. 117 + 110: 65 .. 117 + 116: 65 .. 65 + 120: 65 .. 65 + + source paths: + 0: 42 [] + +Attributes (2 bytes, starting from ): + SOURCEFILEattr 42 [] diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index e32af8691fb4..b3c09baf8494 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -2035,30 +2035,17 @@ class Namer { typer: Typer => * abstract type member */ def needsTracked(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context) = - lazy val abstractContextBound = isContextBoundWitnessWithAbstractMembers(psym, param, owningSym) - lazy val isRefInSignatures = - psym.maybeOwner.isPrimaryConstructor - && isReferencedInPublicSignatures(psym) lazy val needsTrackedSimp = needsTrackedSimple(psym, param, owningSym) !psym.is(Tracked) - && psym.isTerm - && needsTrackedSimp - - /** Under x.modularity, we add `tracked` to context bound witnesses and - * explicit evidence parameters that have abstract type members - */ - private def isContextBoundWitnessWithAbstractMembers(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context): Boolean = - val accessorSyms = maybeParamAccessors(owningSym, psym) - (owningSym.isClass || owningSym.isAllOf(Given | Method)) - && (param.hasAttachment(ContextBoundParam) || (psym.isOneOf(GivenOrImplicit) && !accessorSyms.forall(_.isOneOf(PrivateLocal)))) - && psym.info.memberNames(abstractTypeNameFilter).nonEmpty + && psym.isTerm + && needsTrackedSimp private def needsTrackedSimple(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context): Boolean = val accessorSyms = maybeParamAccessors(owningSym, psym) (owningSym.isClass || owningSym.isAllOf(Given | Method)) - && !accessorSyms.exists(_.is(Mutable)) - && (param.hasAttachment(ContextBoundParam) || !accessorSyms.forall(_.isOneOf(PrivateLocal))) - && psym.info.memberNames(abstractTypeNameFilter).nonEmpty + && !accessorSyms.exists(_.is(Mutable)) + && (param.hasAttachment(ContextBoundParam) || accessorSyms.exists(!_.isOneOf(PrivateLocal))) + && psym.info.memberNames(abstractTypeNameFilter).nonEmpty extension (sym: Symbol) private def infoWithForceNonInferingCompleter(using Context): Type = sym.infoOrCompleter match @@ -2066,34 +2053,6 @@ class Namer { typer: Typer => case tpe if sym.isType => sym.info case info => info - /** Under x.modularity, we add `tracked` to term parameters whose types are - * referenced in public signatures of the defining class - */ - private def isReferencedInPublicSignatures(sym: Symbol)(using Context): Boolean = - val owner = sym.maybeOwner.maybeOwner - val accessorSyms = maybeParamAccessors(owner, sym) - def checkOwnerMemberSignatures(owner: Symbol): Boolean = - owner.infoOrCompleter match - case info: ClassInfo => - info.decls.filter(_.isPublic) - .filter(_ != sym.maybeOwner) - .exists { decl => - tpeContainsSymbolRef(decl.infoWithForceNonInferingCompleter, accessorSyms) - } - case _ => false - checkOwnerMemberSignatures(owner) - - /** Check if any of syms are referenced in tpe */ - private def tpeContainsSymbolRef(tpe: Type, syms: List[Symbol])(using Context): Boolean = - val acc = new ExistsAccumulator( - { tpe => tpe.termSymbol.exists && syms.contains(tpe.termSymbol) }, - StopAt.Static, - forceLazy = false - ) { - override def apply(acc: Boolean, tpe: Type): Boolean = super.apply(acc, tpe.safeDealias) - } - acc(false, tpe) - private def maybeParamAccessors(owner: Symbol, sym: Symbol)(using Context): List[Symbol] = owner.infoOrCompleter match case info: ClassInfo => info.decls.lookupAll(sym.name).filter(d => d.is(ParamAccessor)).toList diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index c2e65337a7fe..422eb04ef63c 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -953,6 +953,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer case _ => notAMemberErrorType(tree, qual, pt)) + println(i"typedSelectWithAdapt $tree, $pt, $qual") tryType(tree, qual, rawType) .orElse(trySimplifyApply()) .orElse(tryInstantiateTypeVar()) diff --git a/simple-tracked-inference-failures-clean.md b/simple-tracked-inference-failures-clean.md new file mode 100644 index 000000000000..1092b3345ceb --- /dev/null +++ b/simple-tracked-inference-failures-clean.md @@ -0,0 +1,329 @@ +# Simple Tracked Inference Failures + +## Failed tests: +- tests/neg/experimentalEnum.scala failed +- tests/neg/experimental.scala failed +- tests/neg/experimentalSam.scala failed +- tests/neg/experimentalRHS.scala failed +- tests/neg/experimental-nested-imports.scala failed +- tests/neg/use-experimental-def.scala failed +- tests/neg/experimentalDefaultParams.scala failed +- tests/neg/i17292b.scala failed +- tests/neg/experimental-message-experimental-flag failed +- tests/neg/tracked2.scala failed +- tests/neg/experimentalUnapply.scala failed +- tests/neg/14034.scala failed +- tests/neg/experimental-nested-imports-2.scala failed +- tests/neg/experimentalSignature.scala failed +- tests/neg/experimental-imports.scala failed +- tests/neg/i13091.scala failed +- tests/neg/i17292.scala failed +- tests/neg/experimental-nested-imports-3.scala failed +- tests/neg/i13848.scala failed +- tests/neg/experimentalMembers.scala failed +- tests/neg/experimentalType.scala failed +- tests/neg/experimentalTypeRHS.scala failed +- tests/neg/experimentalTests.scala failed +- tests/neg/experimentalInline2.scala failed +- tests/neg/experimentalTerms.scala failed +- tests/neg/experimentalTypes2.scala failed +- tests/neg/experimentalAnnot.scala failed +- tests/neg/experimentalCaseClass.scala failed +- tests/neg/experimentalOverride.scala failed +- tests/neg/expeimental-flag.scala failed +- tests/neg/experimentalInline.scala failed +- tests/neg/experimental-message.scala failed +- tests/pos/i12953.scala failed +- tests/pos/i2997.scala failed +- tests/pos/i20901 failed +- tests/pos/i12953.scala failed +- tests/pos/i2997.scala failed + +## Non-experimental related tests: +- tests/pos/i12953.scala failed +- tests/pos/i2997.scala failed +- tests/pos/i20901 failed + +### One TASTY change, which is expected. Unrelated to tracked, only to `@WitnessNames` annotations AFAIK: +- tests/pos/i20901 failed + +source: +```scala +//> using options -Ytest-pickler-check + +import reflect.ClassTag + +class Foo: + def mkArray[T: ClassTag]: Nothing = ??? +``` + +diff +```scala +diff --git a/tests/pos/i20901/Foo.tastycheck b/after-printing.txt +index 82e95946f9..90cfcf8e95 100644 +--- a/tests/pos/i20901/Foo.tastycheck ++++ b/after-printing.txt +@@ -3,7 +3,7 @@ Header: + tooling: + UUID: + +-Names (276 bytes, starting from ): ++Names (351 bytes, starting from ): + 0: ASTs + 1: + 2: scala +@@ -23,32 +23,42 @@ Names (276 bytes, starting from ): + 16: T + 17: Nothing + 18: Any +- 19: evidence$ +- 20: [Unique evidence$ 1] +- 21: ??? +- 22: Predef +- 23: SourceFile +- 24: annotation +- 25: scala[Qualified . annotation] +- 26: internal +- 27: scala[Qualified . annotation][Qualified . internal] +- 28: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] +- 29: String +- 30: java[Qualified . lang][Qualified . String] +- 31: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] +- 32: +- 33: Positions +- 34: Comments +- 35: Attributes ++ 19: WitnessNames ++ 20: annotation ++ 21: scala[Qualified . annotation] ++ 22: internal ++ 23: scala[Qualified . annotation][Qualified . internal] ++ 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] ++ 25: collection ++ 26: scala[Qualified . collection] ++ 27: immutable ++ 28: scala[Qualified . collection][Qualified . immutable] ++ 29: Seq ++ 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] ++ 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] ++ 32: String ++ 33: evidence$1 ++ 34: evidence$ ++ 35: [Unique evidence$ 1] ++ 36: ??? ++ 37: Predef ++ 38: SourceFile ++ 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] ++ 40: java[Qualified . lang][Qualified . String] ++ 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] ++ 42: ++ 43: Positions ++ 44: Comments ++ 45: Attributes + +-Trees (98 bytes, starting from ): +- 0: PACKAGE(96) ++Trees (122 bytes, starting from ): ++ 0: PACKAGE(120) + 2: TERMREFpkg 1 [] + 4: IMPORT(4) + 6: TERMREFpkg 4 [scala[Qualified . reflect]] + 8: IMPORTED 5 [ClassTag] +- 10: TYPEDEF(86) 6 [Foo] +- 13: TEMPLATE(65) ++ 10: TYPEDEF(110) 6 [Foo] ++ 13: TEMPLATE(89) + 15: APPLY(10) + 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] + 20: NEW +@@ -60,39 +70,51 @@ Trees (98 bytes, starting from ): + 31: TYPEREF 14 [Unit] + 33: TERMREFpkg 2 [scala] + 35: STABLE +- 36: DEFDEF(42) 15 [mkArray] +- 39: TYPEPARAM(11) 16 [T] ++ 36: DEFDEF(66) 15 [mkArray] ++ 39: TYPEPARAM(35) 16 [T] + 42: TYPEBOUNDStpt(8) + 44: TYPEREF 17 [Nothing] + 46: SHAREDtype 33 + 48: TYPEREF 18 [Any] + 50: SHAREDtype 33 +- 52: PARAM(14) 20 [[Unique evidence$ 1]] +- 55: APPLIEDtpt(10) +- 57: IDENTtpt 5 [ClassTag] +- 59: TYPEREF 5 [ClassTag] +- 61: SHAREDtype 6 +- 63: IDENTtpt 16 [T] +- 65: TYPEREFdirect 39 +- 67: GIVEN +- 68: IDENTtpt 17 [Nothing] +- 70: TYPEREF 17 [Nothing] +- 72: TERMREFpkg 2 [scala] +- 74: TERMREF 21 [???] +- 76: TERMREF 22 [Predef] +- 78: SHAREDtype 33 +- 80: ANNOTATION(16) +- 82: TYPEREF 23 [SourceFile] +- 84: TERMREFpkg 27 [scala[Qualified . annotation][Qualified . internal]] +- 86: APPLY(10) +- 88: SELECTin(6) 31 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] +- 91: NEW +- 92: SHAREDtype 82 +- 94: SHAREDtype 82 +- 96: STRINGconst 32 [] +- 98: ++ 52: ANNOTATION(22) ++ 54: TYPEREF 19 [WitnessNames] ++ 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] ++ 58: APPLY(16) ++ 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] ++ 63: NEW ++ 64: SHAREDtype 54 ++ 66: SHAREDtype 54 ++ 68: REPEATED(6) ++ 70: TYPEREF 32 [String] ++ 72: SHAREDtype 23 ++ 74: STRINGconst 33 [evidence$1] ++ 76: PARAM(14) 35 [[Unique evidence$ 1]] ++ 79: APPLIEDtpt(10) ++ 81: IDENTtpt 5 [ClassTag] ++ 83: TYPEREF 5 [ClassTag] ++ 85: SHAREDtype 6 ++ 87: IDENTtpt 16 [T] ++ 89: TYPEREFdirect 39 ++ 91: GIVEN ++ 92: IDENTtpt 17 [Nothing] ++ 94: TYPEREF 17 [Nothing] ++ 96: TERMREFpkg 2 [scala] ++ 98: TERMREF 36 [???] ++ 100: TERMREF 37 [Predef] ++ 102: SHAREDtype 33 ++ 104: ANNOTATION(16) ++ 106: TYPEREF 38 [SourceFile] ++ 108: SHAREDtype 56 ++ 110: APPLY(10) ++ 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] ++ 115: NEW ++ 116: SHAREDtype 106 ++ 118: SHAREDtype 106 ++ 120: STRINGconst 42 [] ++ 122: + +-Positions (75 bytes, starting from ): ++Positions (83 bytes, starting from ): + lines: 7 + line sizes: + 38, 0, 23, 0, 10, 41, 0 +@@ -110,17 +132,20 @@ Positions (75 bytes, starting from ): + 39: 90 .. 101 + 44: 93 .. 93 + 48: 93 .. 93 +- 52: 93 .. 101 +- 57: 93 .. 101 +- 63: 93 .. 101 +- 68: 104 .. 111 +- 74: 114 .. 117 +- 86: 65 .. 117 +- 92: 65 .. 65 +- 96: 65 .. 65 ++ 64: 90 .. 90 ++ 70: 90 .. 90 ++ 74: 90 .. 90 ++ 76: 93 .. 101 ++ 81: 93 .. 101 ++ 87: 93 .. 101 ++ 92: 104 .. 111 ++ 98: 114 .. 117 ++ 110: 65 .. 117 ++ 116: 65 .. 65 ++ 120: 65 .. 65 + + source paths: +- 0: 32 [] ++ 0: 42 [] + + Attributes (2 bytes, starting from ): +- SOURCEFILEattr 32 [] ++ SOURCEFILEattr 42 [] +``` + +### One problem with typing annotations too early: +- tests/pos/i12953.scala + +source: +```scala +class Schema(impl: Class[_]) extends scala.annotation.StaticAnnotation + +class Ann[A] extends scala.annotation.StaticAnnotation + +case class Foo[A](@Schema(classOf[List[A]]) foo: String) +case class Bar[A](@Ann[A] foo: String) +def baz[A](@Ann[A] foo: String) = () +``` + +error: +```scala +-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ------------------------- +5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ------------------------- +6 |case class Bar[A](@Ann[A] foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- Warning: tests/pos/i12953.scala:1:25 ---------------------------------------- +1 |class Schema(impl: Class[_]) extends scala.annotation.StaticAnnotation + | ^ + |`_` is deprecated for wildcard arguments of types: use `?` instead + |This construct can be rewritten automatically under -rewrite -source 3.4-migration. +``` + +### One type checking error involving Selectable: +- tests/pos/i2997.scala + +test: +```scala +case class Foo[T <: Int with Singleton](t : T) + +object Test { + val one = 1 + final val final_one = 1 + val a : 1 = Foo(1).t + val b : one.type = Foo(one).t + val c : 1 = Foo(final_one).t +} +``` + +error: +```scala +-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 ---------------------- +6 | val a : 1 = Foo(1).t + | ^^^^^^ + | Found: Foo[(1 : Int)]{val t: (1 : Int)} + | Required: Selectable | Dynamic + | + | The following import might fix the problem: + | + | import scala.reflect.Selectable.reflectiveSelectable + | + | + | longer explanation available when compiling with `-explain` +``` + +`tracked`-less reproduction: +```scala +case class Foo(t : Int) + +object Foo { + def apply(t0: Int) : Foo {val t : t0.type} = ??? +} + +object Test { + val a : 1 = Foo(1).t +} +``` \ No newline at end of file diff --git a/simple-tracked-inference-failures-edited.md b/simple-tracked-inference-failures-edited.md new file mode 100644 index 000000000000..ab142879b08d --- /dev/null +++ b/simple-tracked-inference-failures-edited.md @@ -0,0 +1,388 @@ +sbt:scala3> testCompilation +[info] Test run dotty.tools.dotc.CompilationTests started +[info] Test dotty.tools.dotc.CompilationTests.parallelBackend started +[info] Test dotty.tools.dotc.CompilationTests.negAll started +[error] Test dotty.tools.dotc.CompilationTests.negAll failed: java.lang.AssertionError: Neg test should have failed, but did not, took 61.516 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkExpectedErrors(ParallelTesting.scala:1218) +[error] at dotty.tools.dotc.CompilationTests.negAll(CompilationTests.scala:160) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.runAll started +[=======================================>] completed (1723/1723, 0 failed, 69s) +[info] Test dotty.tools.dotc.CompilationTests.pickling started +[======> ] completed (893/4754, 0 failed, 10s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- +5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- +6 |case class Bar[A](@Ann[A] foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i12953.scala' +[=====================> ] completed (2655/4754, 1 failed, 31s)Compilation failed for: 'tests/pos/i2997.scala' +-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- +6 | val a : 1 = Foo(1).t + | ^^^^^^ + | Found: Foo[(1 : scala.Int)]{val t: (1 : scala.Int)} + | Required: scala.Selectable | scala.Dynamic + | + | The following import might fix the problem: + | + | import scala.reflect.Selectable.reflectiveSelectable + | + | + | longer explanation available when compiling with `-explain` +[=========================> ] completed (3119/4754, 2 failed, 36s)Fatal compiler crash when compiling: tests/pos/i20901: +TASTy printer difference for class Foo in tests/pos/i20901/Foo.scala, did not match tests/pos/i20901/Foo.tastycheck, + output dumped in after-printing.txt, check diff with `git diff --no-index -- tests/pos/i20901/Foo.tastycheck after-printing.txt` + actual output: +Header: + version: + tooling: + UUID: + +Names (351 bytes, starting from ): + 0: ASTs + 1: + 2: scala + 3: reflect + 4: scala[Qualified . reflect] + 5: ClassTag + 6: Foo + 7: + 8: java + 9: lang + 10: java[Qualified . lang] + 11: Object + 12: java[Qualified . lang][Qualified . Object] + 13: [Signed Signature(List(),java.lang.Object) @] + 14: Unit + 15: mkArray + 16: T + 17: Nothing + 18: Any + 19: WitnessNames + 20: annotation + 21: scala[Qualified . annotation] + 22: internal + 23: scala[Qualified . annotation][Qualified . internal] + 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] + 25: collection + 26: scala[Qualified . collection] + 27: immutable + 28: scala[Qualified . collection][Qualified . immutable] + 29: Seq + 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] + 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] + 32: String + 33: evidence$1 + 34: evidence$ + 35: [Unique evidence$ 1] + 36: ??? + 37: Predef + 38: SourceFile + 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] + 40: java[Qualified . lang][Qualified . String] + 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] + 42: + 43: Positions + 44: Comments + 45: Attributes + +Trees (122 bytes, starting from ): + 0: PACKAGE(120) + 2: TERMREFpkg 1 [] + 4: IMPORT(4) + 6: TERMREFpkg 4 [scala[Qualified . reflect]] + 8: IMPORTED 5 [ClassTag] + 10: TYPEDEF(110) 6 [Foo] + 13: TEMPLATE(89) + 15: APPLY(10) + 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] + 20: NEW + 21: TYPEREF 11 [Object] + 23: TERMREFpkg 10 [java[Qualified . lang]] + 25: SHAREDtype 21 + 27: DEFDEF(7) 7 [] + 30: EMPTYCLAUSE + 31: TYPEREF 14 [Unit] + 33: TERMREFpkg 2 [scala] + 35: STABLE + 36: DEFDEF(66) 15 [mkArray] + 39: TYPEPARAM(35) 16 [T] + 42: TYPEBOUNDStpt(8) + 44: TYPEREF 17 [Nothing] + 46: SHAREDtype 33 + 48: TYPEREF 18 [Any] + 50: SHAREDtype 33 + 52: ANNOTATION(22) + 54: TYPEREF 19 [WitnessNames] + 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] + 58: APPLY(16) + 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] + 63: NEW + 64: SHAREDtype 54 + 66: SHAREDtype 54 + 68: REPEATED(6) + 70: TYPEREF 32 [String] + 72: SHAREDtype 23 + 74: STRINGconst 33 [evidence$1] + 76: PARAM(14) 35 [[Unique evidence$ 1]] + 79: APPLIEDtpt(10) + 81: IDENTtpt 5 [ClassTag] + 83: TYPEREF 5 [ClassTag] + 85: SHAREDtype 6 + 87: IDENTtpt 16 [T] + 89: TYPEREFdirect 39 + 91: GIVEN + 92: IDENTtpt 17 [Nothing] + 94: TYPEREF 17 [Nothing] + 96: TERMREFpkg 2 [scala] + 98: TERMREF 36 [???] + 100: TERMREF 37 [Predef] + 102: SHAREDtype 33 + 104: ANNOTATION(16) + 106: TYPEREF 38 [SourceFile] + 108: SHAREDtype 56 + 110: APPLY(10) + 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] + 115: NEW + 116: SHAREDtype 106 + 118: SHAREDtype 106 + 120: STRINGconst 42 [] + 122: + +Positions (83 bytes, starting from ): + lines: 7 + line sizes: + 38, 0, 23, 0, 10, 41, 0 + positions: + 0: 40 .. 117 + 4: 40 .. 63 + 6: 47 .. 54 + 8: 55 .. 63 + 10: 65 .. 117 + 13: 78 .. 117 + 21: 71 .. 71 + 27: 78 .. 78 + 31: 78 .. 78 + 36: 78 .. 117 + 39: 90 .. 101 + 44: 93 .. 93 + 48: 93 .. 93 + 64: 90 .. 90 + 70: 90 .. 90 + 74: 90 .. 90 + 76: 93 .. 101 + 81: 93 .. 101 + 87: 93 .. 101 + 92: 104 .. 111 + 98: 114 .. 117 + 110: 65 .. 117 + 116: 65 .. 65 + 120: 65 .. 65 + + source paths: + 0: 42 [] + +Attributes (2 bytes, starting from ): + SOURCEFILEattr 42 [] + at dotty.tools.dotc.reporting.ThrowingReporter.doReport(ThrowingReporter.scala:14) + at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:160) + at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:191) + at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:210) + at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:213) + at dotty.tools.dotc.report$.error(report.scala:69) + at dotty.tools.dotc.transform.Pickler.testSamePrinted$$anonfun$1(Pickler.scala:482) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.Option.foreach(Option.scala:437) + at dotty.tools.dotc.transform.Pickler.testSamePrinted(Pickler.scala:477) + at dotty.tools.dotc.transform.Pickler.testUnpickler$$anonfun$2(Pickler.scala:456) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619) + at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617) + at scala.collection.AbstractIterable.foreach(Iterable.scala:935) + at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:905) + at dotty.tools.dotc.transform.Pickler.testUnpickler(Pickler.scala:442) + at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:412) + at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:367) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1324) + at dotty.tools.dotc.Run.runPhases$1(Run.scala:360) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:407) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:407) + at scala.Function0.apply$mcV$sp(Function0.scala:42) + at dotty.tools.dotc.Run.showProgress(Run.scala:469) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:407) + at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:419) + at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69) + at dotty.tools.dotc.Run.compileUnits(Run.scala:419) + at dotty.tools.dotc.Run.compileSources(Run.scala:306) + at dotty.tools.dotc.Run.compile(Run.scala:291) + at dotty.tools.dotc.Driver.doCompile(Driver.scala:37) + at dotty.tools.dotc.Driver.process(Driver.scala:201) + at dotty.tools.dotc.Driver.process(Driver.scala:169) + at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:564) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:261) + at scala.collection.immutable.List.map(List.scala:247) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:259) + at scala.util.Try$.apply(Try.scala:217) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:264) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$1(ParallelTesting.scala:295) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:298) + at scala.Function0.apply$mcV$sp(Function0.scala:42) + at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:482) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource(ParallelTesting.scala:298) + at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:378) + at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:360) + at dotty.tools.vulpix.ParallelTesting$$anon$3.run(ParallelTesting.scala:293) + at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375) + at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) + at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) + at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) + at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) + at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) +[=======================================>] completed (4754/4754, 3 failed, 76s) +[error] Test dotty.tools.dotc.CompilationTests.pickling failed: java.lang.AssertionError: Pos test failed, but should not, reasons: +[error] encountered 3 test failure(s): +[error] - generic failure (see test output), took 77.724 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) +[error] at dotty.tools.dotc.CompilationTests.pickling(CompilationTests.scala:195) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.rewrites started +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (24/24, 0 failed, 1s) +[info] Test dotty.tools.dotc.CompilationTests.pos started +[==> ] completed (273/3538, 0 failed, 6s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- +5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- +6 |case class Bar[A](@Ann[A] foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i12953.scala' +[========> ] completed (825/3538, 1 failed, 16s)-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- +6 | val a : 1 = Foo(1).t + | ^^^^^^ + | Found: Foo[(1 : Int)]{val t: (1 : Int)} + | Required: Selectable | Dynamic + | + | The following import might fix the problem: + | + | import scala.reflect.Selectable.reflectiveSelectable + | + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i2997.scala' +[=======================================>] completed (3538/3538, 2 failed, 92s) +[error] Test dotty.tools.dotc.CompilationTests.pos failed: java.lang.AssertionError: Pos test failed, but should not, reasons: +[error] encountered 2 test failure(s): +[error] - generic failure (see test output), took 93.413 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) +[error] at dotty.tools.dotc.CompilationTests.pos(CompilationTests.scala:55) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.warn started +[=======================================>] completed (275/275, 0 failed, 5s) +[info] Test dotty.tools.dotc.CompilationTests.posCC started +[=======================================>] completed (149/149, 0 failed, 2s) +[info] Test dotty.tools.dotc.CompilationTests.checkInit started +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (149/149, 0 failed, 1s) +[=======================================>] completed (59/59, 0 failed, 0s) +[=======================================>] completed (25/25, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.posTwice started +[=======================================>] completed (133/133, 0 failed, 11s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsNeg started +[=======================================>] completed (73/73, 0 failed, 3s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsPos started +[=======================================>] completed (98/98, 0 failed, 5s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsRun started +[=======================================>] completed (12/12, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.checkInitGlobal started +[=======================================>] completed (56/56, 0 failed, 0s) +[=======================================>] completed (48/48, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.fuzzyAll started +[=======================================>] completed (184/184, 0 failed, 2s) +[info] Test dotty.tools.dotc.CompilationTests.genericJavaSignatures started +[=======================================>] completed (26/26, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsWarn started +[=======================================>] completed (2/2, 0 failed, 0s) + +================================================================================ +Test Report +================================================================================ + +51 suites passed, 3 failed, 54 total + tests/pos/i12953.scala failed + tests/pos/i2997.scala failed + tests/pos/i20901 failed + +-------------------------------------------------------------------------------- +Note - reproduction instructions have been dumped to log file: + /home/kpi/scala3/testlogs/tests-2025-04-14/tests-2025-04-14-T09-36-43.log +-------------------------------------------------------------------------------- +[info] Test run dotty.tools.dotc.CompilationTests finished: 3 failed, 0 ignored, 17 total, 364.817s +[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests started +[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests finished: 0 failed, 0 ignored, 0 total, 0.0s +[info] Test run dotty.tools.dotc.coverage.CoverageTests started +[info] Test run dotty.tools.dotc.coverage.CoverageTests finished: 0 failed, 0 ignored, 0 total, 0.0s +[error] Failed: Total 17, Failed 3, Errors 0, Passed 14 +[error] Failed tests: +[error] dotty.tools.dotc.CompilationTests +[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful +[error] Total time: 367 s (06:07), completed Apr 14, 2025, 9:40:05 AM diff --git a/simple-tracked-inference-failures.md b/simple-tracked-inference-failures.md new file mode 100644 index 000000000000..55b390421eb7 --- /dev/null +++ b/simple-tracked-inference-failures.md @@ -0,0 +1,492 @@ +sbt:scala3> testCompilation +[info] Test run dotty.tools.dotc.CompilationTests started +[info] Test dotty.tools.dotc.CompilationTests.parallelBackend started +[ ] completed (0/7, 0 failed, 2s)[warn] Metals requires the semanticdb compiler plugin +[warn] consider setting 'Global / semanticdbEnabled := true' in your global sbt settings ($HOME/.sbt/1.0) +[=======================================>] completed (7/7, 0 failed, 18s) +[=======================================>] completed (2/2, 0 failed, 0s) +[=======================================>] completed (2/2, 0 failed, 2s) +[info] Test dotty.tools.dotc.CompilationTests.negAll started +[===> ] completed (233/1928, 0 failed, 8s) +No errors found when compiling neg test tests/neg/experimental-nested-imports-2.scala +[====> ] completed (257/1928, 1 failed, 8s) +No errors found when compiling neg test tests/neg/experimentalDefaultParams.scala +[=====> ] completed (300/1928, 2 failed, 10s) +No errors found when compiling neg test tests/neg/expeimental-flag.scala +[========> ] completed (449/1928, 3 failed, 14s) +No errors found when compiling neg test tests/neg/experimental.scala +[=========> ] completed (489/1928, 4 failed, 14s) +No errors found when compiling neg test tests/neg/experimentalTypes2.scala +[==========> ] completed (537/1928, 5 failed, 16s) +No errors found when compiling neg test tests/neg/experimental-message.scala +[============> ] completed (649/1928, 6 failed, 18s) +No errors found when compiling neg test tests/neg/experimental-nested-imports-3.scala +[============> ] completed (671/1928, 7 failed, 18s) +No errors found when compiling neg test tests/neg/i13848.scala +[=============> ] completed (687/1928, 8 failed, 19s) +No errors found when compiling neg test tests/neg/experimentalUnapply.scala +[=============> ] completed (696/1928, 9 failed, 19s) +No errors found when compiling neg test tests/neg/experimentalType.scala +[===============> ] completed (779/1928, 10 failed, 21s) +No errors found when compiling neg test tests/neg/experimentalTests.scala +[================> ] completed (852/1928, 11 failed, 22s) +No errors found when compiling neg test tests/neg/experimental-nested-imports.scala +[=================> ] completed (889/1928, 12 failed, 23s) +No errors found when compiling neg test tests/neg/14034.scala + +No errors found when compiling neg test tests/neg/experimentalAnnot.scala +[=================> ] completed (908/1928, 14 failed, 23s) +No errors found when compiling neg test tests/neg/experimentalInline.scala +[==================> ] completed (946/1928, 15 failed, 24s) +No errors found when compiling neg test tests/neg/experimentalSignature.scala +[===================> ] completed (969/1928, 16 failed, 24s) +No errors found when compiling neg test tests/neg/experimentalInline2.scala +[===================> ] completed (996/1928, 17 failed, 25s) +No errors found when compiling neg test tests/neg/experimentalCaseClass.scala +[=====================> ] completed (1067/1928, 18 failed, 27s) +No errors found when compiling neg test tests/neg/experimentalMembers.scala + +No errors found when compiling neg test tests/neg/tracked2.scala +[=====================> ] completed (1082/1928, 20 failed, 27s) +No errors found when compiling neg test tests/neg/experimentalTypeRHS.scala + +No errors found when compiling neg test tests/neg/i13091.scala +[=====================> ] completed (1094/1928, 22 failed, 27s) +No errors found when compiling neg test tests/neg/i17292.scala +[======================> ] completed (1121/1928, 23 failed, 28s) +No errors found when compiling neg test tests/neg/experimentalEnum.scala +[==========================> ] completed (1348/1928, 24 failed, 33s) +No errors found when compiling neg test tests/neg/experimentalOverride.scala + +No errors found when compiling neg test tests/neg/experimental-imports.scala +[===========================> ] completed (1386/1928, 26 failed, 33s) +No errors found when compiling neg test tests/neg/i17292b.scala +[============================> ] completed (1427/1928, 27 failed, 34s) +No errors found when compiling neg test tests/neg/use-experimental-def.scala +[=============================> ] completed (1459/1928, 28 failed, 35s) +No errors found when compiling neg test tests/neg/experimentalRHS.scala +[==============================> ] completed (1497/1928, 29 failed, 36s) +No errors found when compiling neg test tests/neg/experimentalSam.scala +[==============================> ] completed (1516/1928, 30 failed, 36s) +No errors found when compiling neg test tests/neg/experimentalTerms.scala +[=================================> ] completed (1669/1928, 31 failed, 42s) +No errors found when compiling neg test neg/experimental-message-experimental-flag +[=======================================>] completed (1928/1928, 32 failed, 61s) +[error] Test dotty.tools.dotc.CompilationTests.negAll failed: java.lang.AssertionError: Neg test should have failed, but did not, took 61.516 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkExpectedErrors(ParallelTesting.scala:1218) +[error] at dotty.tools.dotc.CompilationTests.negAll(CompilationTests.scala:160) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.runAll started +[=======================================>] completed (1723/1723, 0 failed, 69s) +[info] Test dotty.tools.dotc.CompilationTests.pickling started +[======> ] completed (893/4754, 0 failed, 10s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- +5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- +6 |case class Bar[A](@Ann[A] foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i12953.scala' +[=====================> ] completed (2655/4754, 1 failed, 31s)Compilation failed for: 'tests/pos/i2997.scala' +-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- +6 | val a : 1 = Foo(1).t + | ^^^^^^ + | Found: Foo[(1 : scala.Int)]{val t: (1 : scala.Int)} + | Required: scala.Selectable | scala.Dynamic + | + | The following import might fix the problem: + | + | import scala.reflect.Selectable.reflectiveSelectable + | + | + | longer explanation available when compiling with `-explain` +[=========================> ] completed (3119/4754, 2 failed, 36s)Fatal compiler crash when compiling: tests/pos/i20901: +TASTy printer difference for class Foo in tests/pos/i20901/Foo.scala, did not match tests/pos/i20901/Foo.tastycheck, + output dumped in after-printing.txt, check diff with `git diff --no-index -- tests/pos/i20901/Foo.tastycheck after-printing.txt` + actual output: +Header: + version: + tooling: + UUID: + +Names (351 bytes, starting from ): + 0: ASTs + 1: + 2: scala + 3: reflect + 4: scala[Qualified . reflect] + 5: ClassTag + 6: Foo + 7: + 8: java + 9: lang + 10: java[Qualified . lang] + 11: Object + 12: java[Qualified . lang][Qualified . Object] + 13: [Signed Signature(List(),java.lang.Object) @] + 14: Unit + 15: mkArray + 16: T + 17: Nothing + 18: Any + 19: WitnessNames + 20: annotation + 21: scala[Qualified . annotation] + 22: internal + 23: scala[Qualified . annotation][Qualified . internal] + 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] + 25: collection + 26: scala[Qualified . collection] + 27: immutable + 28: scala[Qualified . collection][Qualified . immutable] + 29: Seq + 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] + 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] + 32: String + 33: evidence$1 + 34: evidence$ + 35: [Unique evidence$ 1] + 36: ??? + 37: Predef + 38: SourceFile + 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] + 40: java[Qualified . lang][Qualified . String] + 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] + 42: + 43: Positions + 44: Comments + 45: Attributes + +Trees (122 bytes, starting from ): + 0: PACKAGE(120) + 2: TERMREFpkg 1 [] + 4: IMPORT(4) + 6: TERMREFpkg 4 [scala[Qualified . reflect]] + 8: IMPORTED 5 [ClassTag] + 10: TYPEDEF(110) 6 [Foo] + 13: TEMPLATE(89) + 15: APPLY(10) + 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] + 20: NEW + 21: TYPEREF 11 [Object] + 23: TERMREFpkg 10 [java[Qualified . lang]] + 25: SHAREDtype 21 + 27: DEFDEF(7) 7 [] + 30: EMPTYCLAUSE + 31: TYPEREF 14 [Unit] + 33: TERMREFpkg 2 [scala] + 35: STABLE + 36: DEFDEF(66) 15 [mkArray] + 39: TYPEPARAM(35) 16 [T] + 42: TYPEBOUNDStpt(8) + 44: TYPEREF 17 [Nothing] + 46: SHAREDtype 33 + 48: TYPEREF 18 [Any] + 50: SHAREDtype 33 + 52: ANNOTATION(22) + 54: TYPEREF 19 [WitnessNames] + 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] + 58: APPLY(16) + 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] + 63: NEW + 64: SHAREDtype 54 + 66: SHAREDtype 54 + 68: REPEATED(6) + 70: TYPEREF 32 [String] + 72: SHAREDtype 23 + 74: STRINGconst 33 [evidence$1] + 76: PARAM(14) 35 [[Unique evidence$ 1]] + 79: APPLIEDtpt(10) + 81: IDENTtpt 5 [ClassTag] + 83: TYPEREF 5 [ClassTag] + 85: SHAREDtype 6 + 87: IDENTtpt 16 [T] + 89: TYPEREFdirect 39 + 91: GIVEN + 92: IDENTtpt 17 [Nothing] + 94: TYPEREF 17 [Nothing] + 96: TERMREFpkg 2 [scala] + 98: TERMREF 36 [???] + 100: TERMREF 37 [Predef] + 102: SHAREDtype 33 + 104: ANNOTATION(16) + 106: TYPEREF 38 [SourceFile] + 108: SHAREDtype 56 + 110: APPLY(10) + 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] + 115: NEW + 116: SHAREDtype 106 + 118: SHAREDtype 106 + 120: STRINGconst 42 [] + 122: + +Positions (83 bytes, starting from ): + lines: 7 + line sizes: + 38, 0, 23, 0, 10, 41, 0 + positions: + 0: 40 .. 117 + 4: 40 .. 63 + 6: 47 .. 54 + 8: 55 .. 63 + 10: 65 .. 117 + 13: 78 .. 117 + 21: 71 .. 71 + 27: 78 .. 78 + 31: 78 .. 78 + 36: 78 .. 117 + 39: 90 .. 101 + 44: 93 .. 93 + 48: 93 .. 93 + 64: 90 .. 90 + 70: 90 .. 90 + 74: 90 .. 90 + 76: 93 .. 101 + 81: 93 .. 101 + 87: 93 .. 101 + 92: 104 .. 111 + 98: 114 .. 117 + 110: 65 .. 117 + 116: 65 .. 65 + 120: 65 .. 65 + + source paths: + 0: 42 [] + +Attributes (2 bytes, starting from ): + SOURCEFILEattr 42 [] + at dotty.tools.dotc.reporting.ThrowingReporter.doReport(ThrowingReporter.scala:14) + at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:160) + at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:191) + at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:210) + at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:213) + at dotty.tools.dotc.report$.error(report.scala:69) + at dotty.tools.dotc.transform.Pickler.testSamePrinted$$anonfun$1(Pickler.scala:482) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.Option.foreach(Option.scala:437) + at dotty.tools.dotc.transform.Pickler.testSamePrinted(Pickler.scala:477) + at dotty.tools.dotc.transform.Pickler.testUnpickler$$anonfun$2(Pickler.scala:456) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619) + at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617) + at scala.collection.AbstractIterable.foreach(Iterable.scala:935) + at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:905) + at dotty.tools.dotc.transform.Pickler.testUnpickler(Pickler.scala:442) + at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:412) + at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:367) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) + at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) + at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1324) + at dotty.tools.dotc.Run.runPhases$1(Run.scala:360) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:407) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:407) + at scala.Function0.apply$mcV$sp(Function0.scala:42) + at dotty.tools.dotc.Run.showProgress(Run.scala:469) + at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:407) + at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:419) + at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69) + at dotty.tools.dotc.Run.compileUnits(Run.scala:419) + at dotty.tools.dotc.Run.compileSources(Run.scala:306) + at dotty.tools.dotc.Run.compile(Run.scala:291) + at dotty.tools.dotc.Driver.doCompile(Driver.scala:37) + at dotty.tools.dotc.Driver.process(Driver.scala:201) + at dotty.tools.dotc.Driver.process(Driver.scala:169) + at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:564) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:261) + at scala.collection.immutable.List.map(List.scala:247) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:259) + at scala.util.Try$.apply(Try.scala:217) + at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:264) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$1(ParallelTesting.scala:295) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:298) + at scala.Function0.apply$mcV$sp(Function0.scala:42) + at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:482) + at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource(ParallelTesting.scala:298) + at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:378) + at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:360) + at dotty.tools.vulpix.ParallelTesting$$anon$3.run(ParallelTesting.scala:293) + at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375) + at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) + at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) + at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) + at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) + at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) +[=======================================>] completed (4754/4754, 3 failed, 76s) +[error] Test dotty.tools.dotc.CompilationTests.pickling failed: java.lang.AssertionError: Pos test failed, but should not, reasons: +[error] encountered 3 test failure(s): +[error] - generic failure (see test output), took 77.724 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) +[error] at dotty.tools.dotc.CompilationTests.pickling(CompilationTests.scala:195) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.rewrites started +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (24/24, 0 failed, 1s) +[info] Test dotty.tools.dotc.CompilationTests.pos started +[==> ] completed (273/3538, 0 failed, 6s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- +5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +-- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- +6 |case class Bar[A](@Ann[A] foo: String) + | ^ + | Not found: type A + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i12953.scala' +[========> ] completed (825/3538, 1 failed, 16s)-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- +6 | val a : 1 = Foo(1).t + | ^^^^^^ + | Found: Foo[(1 : Int)]{val t: (1 : Int)} + | Required: Selectable | Dynamic + | + | The following import might fix the problem: + | + | import scala.reflect.Selectable.reflectiveSelectable + | + | + | longer explanation available when compiling with `-explain` +Compilation failed for: 'tests/pos/i2997.scala' +[=======================================>] completed (3538/3538, 2 failed, 92s) +[error] Test dotty.tools.dotc.CompilationTests.pos failed: java.lang.AssertionError: Pos test failed, but should not, reasons: +[error] encountered 2 test failure(s): +[error] - generic failure (see test output), took 93.413 sec +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) +[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) +[error] at dotty.tools.dotc.CompilationTests.pos(CompilationTests.scala:55) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) +[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) +[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) +[error] at java.lang.reflect.Method.invoke(Method.java:569) +[error] ... +[info] Test dotty.tools.dotc.CompilationTests.warn started +[=======================================>] completed (275/275, 0 failed, 5s) +[info] Test dotty.tools.dotc.CompilationTests.posCC started +[=======================================>] completed (149/149, 0 failed, 2s) +[info] Test dotty.tools.dotc.CompilationTests.checkInit started +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (149/149, 0 failed, 1s) +[=======================================>] completed (59/59, 0 failed, 0s) +[=======================================>] completed (25/25, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[=======================================>] completed (1/1, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.posTwice started +[=======================================>] completed (133/133, 0 failed, 11s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsNeg started +[=======================================>] completed (73/73, 0 failed, 3s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsPos started +[=======================================>] completed (98/98, 0 failed, 5s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsRun started +[=======================================>] completed (12/12, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.checkInitGlobal started +[=======================================>] completed (56/56, 0 failed, 0s) +[=======================================>] completed (48/48, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.fuzzyAll started +[=======================================>] completed (184/184, 0 failed, 2s) +[info] Test dotty.tools.dotc.CompilationTests.genericJavaSignatures started +[=======================================>] completed (26/26, 0 failed, 0s) +[info] Test dotty.tools.dotc.CompilationTests.explicitNullsWarn started +[=======================================>] completed (2/2, 0 failed, 0s) + +================================================================================ +Test Report +================================================================================ + +51 suites passed, 3 failed, 54 total + tests/neg/experimentalEnum.scala failed + tests/neg/experimental.scala failed + tests/neg/experimentalSam.scala failed + tests/neg/experimentalRHS.scala failed + tests/neg/experimental-nested-imports.scala failed + tests/neg/use-experimental-def.scala failed + tests/neg/experimentalDefaultParams.scala failed + tests/neg/i17292b.scala failed + tests/neg/experimental-message-experimental-flag failed + tests/neg/tracked2.scala failed + tests/neg/experimentalUnapply.scala failed + tests/neg/14034.scala failed + tests/neg/experimental-nested-imports-2.scala failed + tests/neg/experimentalSignature.scala failed + tests/neg/experimental-imports.scala failed + tests/neg/i13091.scala failed + tests/neg/i17292.scala failed + tests/neg/experimental-nested-imports-3.scala failed + tests/neg/i13848.scala failed + tests/neg/experimentalMembers.scala failed + tests/neg/experimentalType.scala failed + tests/neg/experimentalTypeRHS.scala failed + tests/neg/experimentalTests.scala failed + tests/neg/experimentalInline2.scala failed + tests/neg/experimentalTerms.scala failed + tests/neg/experimentalTypes2.scala failed + tests/neg/experimentalAnnot.scala failed + tests/neg/experimentalCaseClass.scala failed + tests/neg/experimentalOverride.scala failed + tests/neg/expeimental-flag.scala failed + tests/neg/experimentalInline.scala failed + tests/neg/experimental-message.scala failed + tests/pos/i12953.scala failed + tests/pos/i2997.scala failed + tests/pos/i20901 failed + tests/pos/i12953.scala failed + tests/pos/i2997.scala failed + +-------------------------------------------------------------------------------- +Note - reproduction instructions have been dumped to log file: + /home/kpi/scala3/testlogs/tests-2025-04-14/tests-2025-04-14-T09-36-43.log +-------------------------------------------------------------------------------- +[info] Test run dotty.tools.dotc.CompilationTests finished: 3 failed, 0 ignored, 17 total, 364.817s +[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests started +[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests finished: 0 failed, 0 ignored, 0 total, 0.0s +[info] Test run dotty.tools.dotc.coverage.CoverageTests started +[info] Test run dotty.tools.dotc.coverage.CoverageTests finished: 0 failed, 0 ignored, 0 total, 0.0s +[error] Failed: Total 17, Failed 3, Errors 0, Passed 14 +[error] Failed tests: +[error] dotty.tools.dotc.CompilationTests +[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful +[error] Total time: 367 s (06:07), completed Apr 14, 2025, 9:40:05 AM diff --git a/tasty-fail-diff.txt b/tasty-fail-diff.txt new file mode 100644 index 000000000000..a783034d6dd4 --- /dev/null +++ b/tasty-fail-diff.txt @@ -0,0 +1,187 @@ +diff --git a/tests/pos/i20901/Foo.tastycheck b/after-printing.txt +index 82e95946f9..90cfcf8e95 100644 +--- a/tests/pos/i20901/Foo.tastycheck ++++ b/after-printing.txt +@@ -3,7 +3,7 @@ Header: + tooling: + UUID: + +-Names (276 bytes, starting from ): ++Names (351 bytes, starting from ): + 0: ASTs + 1: + 2: scala +@@ -23,32 +23,42 @@ Names (276 bytes, starting from ): + 16: T + 17: Nothing + 18: Any +- 19: evidence$ +- 20: [Unique evidence$ 1] +- 21: ??? +- 22: Predef +- 23: SourceFile +- 24: annotation +- 25: scala[Qualified . annotation] +- 26: internal +- 27: scala[Qualified . annotation][Qualified . internal] +- 28: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] +- 29: String +- 30: java[Qualified . lang][Qualified . String] +- 31: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] +- 32: +- 33: Positions +- 34: Comments +- 35: Attributes ++ 19: WitnessNames ++ 20: annotation ++ 21: scala[Qualified . annotation] ++ 22: internal ++ 23: scala[Qualified . annotation][Qualified . internal] ++ 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] ++ 25: collection ++ 26: scala[Qualified . collection] ++ 27: immutable ++ 28: scala[Qualified . collection][Qualified . immutable] ++ 29: Seq ++ 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] ++ 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] ++ 32: String ++ 33: evidence$1 ++ 34: evidence$ ++ 35: [Unique evidence$ 1] ++ 36: ??? ++ 37: Predef ++ 38: SourceFile ++ 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] ++ 40: java[Qualified . lang][Qualified . String] ++ 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] ++ 42: ++ 43: Positions ++ 44: Comments ++ 45: Attributes + +-Trees (98 bytes, starting from ): +- 0: PACKAGE(96) ++Trees (122 bytes, starting from ): ++ 0: PACKAGE(120) + 2: TERMREFpkg 1 [] + 4: IMPORT(4) + 6: TERMREFpkg 4 [scala[Qualified . reflect]] + 8: IMPORTED 5 [ClassTag] +- 10: TYPEDEF(86) 6 [Foo] +- 13: TEMPLATE(65) ++ 10: TYPEDEF(110) 6 [Foo] ++ 13: TEMPLATE(89) + 15: APPLY(10) + 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] + 20: NEW +@@ -60,39 +70,51 @@ Trees (98 bytes, starting from ): + 31: TYPEREF 14 [Unit] + 33: TERMREFpkg 2 [scala] + 35: STABLE +- 36: DEFDEF(42) 15 [mkArray] +- 39: TYPEPARAM(11) 16 [T] ++ 36: DEFDEF(66) 15 [mkArray] ++ 39: TYPEPARAM(35) 16 [T] + 42: TYPEBOUNDStpt(8) + 44: TYPEREF 17 [Nothing] + 46: SHAREDtype 33 + 48: TYPEREF 18 [Any] + 50: SHAREDtype 33 +- 52: PARAM(14) 20 [[Unique evidence$ 1]] +- 55: APPLIEDtpt(10) +- 57: IDENTtpt 5 [ClassTag] +- 59: TYPEREF 5 [ClassTag] +- 61: SHAREDtype 6 +- 63: IDENTtpt 16 [T] +- 65: TYPEREFdirect 39 +- 67: GIVEN +- 68: IDENTtpt 17 [Nothing] +- 70: TYPEREF 17 [Nothing] +- 72: TERMREFpkg 2 [scala] +- 74: TERMREF 21 [???] +- 76: TERMREF 22 [Predef] +- 78: SHAREDtype 33 +- 80: ANNOTATION(16) +- 82: TYPEREF 23 [SourceFile] +- 84: TERMREFpkg 27 [scala[Qualified . annotation][Qualified . internal]] +- 86: APPLY(10) +- 88: SELECTin(6) 31 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] +- 91: NEW +- 92: SHAREDtype 82 +- 94: SHAREDtype 82 +- 96: STRINGconst 32 [] +- 98: ++ 52: ANNOTATION(22) ++ 54: TYPEREF 19 [WitnessNames] ++ 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] ++ 58: APPLY(16) ++ 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] ++ 63: NEW ++ 64: SHAREDtype 54 ++ 66: SHAREDtype 54 ++ 68: REPEATED(6) ++ 70: TYPEREF 32 [String] ++ 72: SHAREDtype 23 ++ 74: STRINGconst 33 [evidence$1] ++ 76: PARAM(14) 35 [[Unique evidence$ 1]] ++ 79: APPLIEDtpt(10) ++ 81: IDENTtpt 5 [ClassTag] ++ 83: TYPEREF 5 [ClassTag] ++ 85: SHAREDtype 6 ++ 87: IDENTtpt 16 [T] ++ 89: TYPEREFdirect 39 ++ 91: GIVEN ++ 92: IDENTtpt 17 [Nothing] ++ 94: TYPEREF 17 [Nothing] ++ 96: TERMREFpkg 2 [scala] ++ 98: TERMREF 36 [???] ++ 100: TERMREF 37 [Predef] ++ 102: SHAREDtype 33 ++ 104: ANNOTATION(16) ++ 106: TYPEREF 38 [SourceFile] ++ 108: SHAREDtype 56 ++ 110: APPLY(10) ++ 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] ++ 115: NEW ++ 116: SHAREDtype 106 ++ 118: SHAREDtype 106 ++ 120: STRINGconst 42 [] ++ 122: + +-Positions (75 bytes, starting from ): ++Positions (83 bytes, starting from ): + lines: 7 + line sizes: + 38, 0, 23, 0, 10, 41, 0 +@@ -110,17 +132,20 @@ Positions (75 bytes, starting from ): + 39: 90 .. 101 + 44: 93 .. 93 + 48: 93 .. 93 +- 52: 93 .. 101 +- 57: 93 .. 101 +- 63: 93 .. 101 +- 68: 104 .. 111 +- 74: 114 .. 117 +- 86: 65 .. 117 +- 92: 65 .. 65 +- 96: 65 .. 65 ++ 64: 90 .. 90 ++ 70: 90 .. 90 ++ 74: 90 .. 90 ++ 76: 93 .. 101 ++ 81: 93 .. 101 ++ 87: 93 .. 101 ++ 92: 104 .. 111 ++ 98: 114 .. 117 ++ 110: 65 .. 117 ++ 116: 65 .. 65 ++ 120: 65 .. 65 + + source paths: +- 0: 32 [] ++ 0: 42 [] + + Attributes (2 bytes, starting from ): +- SOURCEFILEattr 32 [] ++ SOURCEFILEattr 42 [] diff --git a/tests/pos/i2997.scala b/tests/pos/i2997.scala index 6234889a88fd..b91b0f8cc085 100644 --- a/tests/pos/i2997.scala +++ b/tests/pos/i2997.scala @@ -1,9 +1,19 @@ -case class Foo[T <: Int with Singleton](t : T) +// case class Foo[T <: Int with Singleton](t : T) + +// object Test { +// val one = 1 +// final val final_one = 1 +// val a : 1 = Foo(1).t +// val b : one.type = Foo(one).t +// val c : 1 = Foo(final_one).t +// } + +case class Foo(t : Int) + +object Foo { + def apply(t0: Int) : Foo {val t : t0.type} = ??? +} object Test { - val one = 1 - final val final_one = 1 val a : 1 = Foo(1).t - val b : one.type = Foo(one).t - val c : 1 = Foo(final_one).t } From a30ce384bc438fbbb2b4253a2fd8785d1dc9755f Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Sun, 10 Aug 2025 15:17:02 +0200 Subject: [PATCH 03/11] Fix eagerly typing annotations when inferring tracked --- .../src/dotty/tools/dotc/config/Feature.scala | 2 +- .../src/dotty/tools/dotc/typer/Namer.scala | 12 ++++--- .../src/dotty/tools/dotc/typer/Typer.scala | 1 - simple-tracked-inference-failures-clean.md | 36 ------------------- 4 files changed, 8 insertions(+), 43 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/config/Feature.scala b/compiler/src/dotty/tools/dotc/config/Feature.scala index fa8d2cdc13f1..6eaa4d5c98a3 100644 --- a/compiler/src/dotty/tools/dotc/config/Feature.scala +++ b/compiler/src/dotty/tools/dotc/config/Feature.scala @@ -112,7 +112,7 @@ object Feature: * feature is defined. */ def enabled(feature: TermName)(using Context): Boolean = - enabledBySetting(feature) || enabledByImport(feature) || feature == modularity + enabledBySetting(feature) || enabledByImport(feature) /** Is auto-tupling enabled? */ def autoTuplingEnabled(using Context): Boolean = !enabled(nme.noAutoTupling) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index b3c09baf8494..ae7d9a2a2cbc 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -2045,13 +2045,15 @@ class Namer { typer: Typer => (owningSym.isClass || owningSym.isAllOf(Given | Method)) && !accessorSyms.exists(_.is(Mutable)) && (param.hasAttachment(ContextBoundParam) || accessorSyms.exists(!_.isOneOf(PrivateLocal))) - && psym.info.memberNames(abstractTypeNameFilter).nonEmpty + && psym.infoDontForceAnnotsAndInferred(param).memberNames(abstractTypeNameFilter).nonEmpty extension (sym: Symbol) - private def infoWithForceNonInferingCompleter(using Context): Type = sym.infoOrCompleter match - case tpe: LazyType if tpe.isExplicit => sym.info - case tpe if sym.isType => sym.info - case info => info + private def infoDontForceAnnotsAndInferred(tree: DefTree)(using Context): Type = + sym.infoOrCompleter match + case tpe if tree.mods.annotations.nonEmpty => tpe + case tpe: LazyType if tpe.isExplicit => sym.info + case tpe if sym.isType => sym.info + case info => info private def maybeParamAccessors(owner: Symbol, sym: Symbol)(using Context): List[Symbol] = owner.infoOrCompleter match case info: ClassInfo => diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 422eb04ef63c..c2e65337a7fe 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -953,7 +953,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer case _ => notAMemberErrorType(tree, qual, pt)) - println(i"typedSelectWithAdapt $tree, $pt, $qual") tryType(tree, qual, rawType) .orElse(trySimplifyApply()) .orElse(tryInstantiateTypeVar()) diff --git a/simple-tracked-inference-failures-clean.md b/simple-tracked-inference-failures-clean.md index 1092b3345ceb..8020546ddbd4 100644 --- a/simple-tracked-inference-failures-clean.md +++ b/simple-tracked-inference-failures-clean.md @@ -40,7 +40,6 @@ - tests/pos/i2997.scala failed ## Non-experimental related tests: -- tests/pos/i12953.scala failed - tests/pos/i2997.scala failed - tests/pos/i20901 failed @@ -248,41 +247,6 @@ index 82e95946f9..90cfcf8e95 100644 + SOURCEFILEattr 42 [] ``` -### One problem with typing annotations too early: -- tests/pos/i12953.scala - -source: -```scala -class Schema(impl: Class[_]) extends scala.annotation.StaticAnnotation - -class Ann[A] extends scala.annotation.StaticAnnotation - -case class Foo[A](@Schema(classOf[List[A]]) foo: String) -case class Bar[A](@Ann[A] foo: String) -def baz[A](@Ann[A] foo: String) = () -``` - -error: -```scala --- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ------------------------- -5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ------------------------- -6 |case class Bar[A](@Ann[A] foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- Warning: tests/pos/i12953.scala:1:25 ---------------------------------------- -1 |class Schema(impl: Class[_]) extends scala.annotation.StaticAnnotation - | ^ - |`_` is deprecated for wildcard arguments of types: use `?` instead - |This construct can be rewritten automatically under -rewrite -source 3.4-migration. -``` - ### One type checking error involving Selectable: - tests/pos/i2997.scala From 600e53280ba274dad349c52c4416ba6443d0039c Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Sun, 10 Aug 2025 15:17:34 +0200 Subject: [PATCH 04/11] Fix failed tracked-related tests --- simple-tracked-inference-failures-clean.md | 293 ------------ simple-tracked-inference-failures-edited.md | 388 --------------- simple-tracked-inference-failures.md | 492 -------------------- 3 files changed, 1173 deletions(-) delete mode 100644 simple-tracked-inference-failures-clean.md delete mode 100644 simple-tracked-inference-failures-edited.md delete mode 100644 simple-tracked-inference-failures.md diff --git a/simple-tracked-inference-failures-clean.md b/simple-tracked-inference-failures-clean.md deleted file mode 100644 index 8020546ddbd4..000000000000 --- a/simple-tracked-inference-failures-clean.md +++ /dev/null @@ -1,293 +0,0 @@ -# Simple Tracked Inference Failures - -## Failed tests: -- tests/neg/experimentalEnum.scala failed -- tests/neg/experimental.scala failed -- tests/neg/experimentalSam.scala failed -- tests/neg/experimentalRHS.scala failed -- tests/neg/experimental-nested-imports.scala failed -- tests/neg/use-experimental-def.scala failed -- tests/neg/experimentalDefaultParams.scala failed -- tests/neg/i17292b.scala failed -- tests/neg/experimental-message-experimental-flag failed -- tests/neg/tracked2.scala failed -- tests/neg/experimentalUnapply.scala failed -- tests/neg/14034.scala failed -- tests/neg/experimental-nested-imports-2.scala failed -- tests/neg/experimentalSignature.scala failed -- tests/neg/experimental-imports.scala failed -- tests/neg/i13091.scala failed -- tests/neg/i17292.scala failed -- tests/neg/experimental-nested-imports-3.scala failed -- tests/neg/i13848.scala failed -- tests/neg/experimentalMembers.scala failed -- tests/neg/experimentalType.scala failed -- tests/neg/experimentalTypeRHS.scala failed -- tests/neg/experimentalTests.scala failed -- tests/neg/experimentalInline2.scala failed -- tests/neg/experimentalTerms.scala failed -- tests/neg/experimentalTypes2.scala failed -- tests/neg/experimentalAnnot.scala failed -- tests/neg/experimentalCaseClass.scala failed -- tests/neg/experimentalOverride.scala failed -- tests/neg/expeimental-flag.scala failed -- tests/neg/experimentalInline.scala failed -- tests/neg/experimental-message.scala failed -- tests/pos/i12953.scala failed -- tests/pos/i2997.scala failed -- tests/pos/i20901 failed -- tests/pos/i12953.scala failed -- tests/pos/i2997.scala failed - -## Non-experimental related tests: -- tests/pos/i2997.scala failed -- tests/pos/i20901 failed - -### One TASTY change, which is expected. Unrelated to tracked, only to `@WitnessNames` annotations AFAIK: -- tests/pos/i20901 failed - -source: -```scala -//> using options -Ytest-pickler-check - -import reflect.ClassTag - -class Foo: - def mkArray[T: ClassTag]: Nothing = ??? -``` - -diff -```scala -diff --git a/tests/pos/i20901/Foo.tastycheck b/after-printing.txt -index 82e95946f9..90cfcf8e95 100644 ---- a/tests/pos/i20901/Foo.tastycheck -+++ b/after-printing.txt -@@ -3,7 +3,7 @@ Header: - tooling: - UUID: - --Names (276 bytes, starting from ): -+Names (351 bytes, starting from ): - 0: ASTs - 1: - 2: scala -@@ -23,32 +23,42 @@ Names (276 bytes, starting from ): - 16: T - 17: Nothing - 18: Any -- 19: evidence$ -- 20: [Unique evidence$ 1] -- 21: ??? -- 22: Predef -- 23: SourceFile -- 24: annotation -- 25: scala[Qualified . annotation] -- 26: internal -- 27: scala[Qualified . annotation][Qualified . internal] -- 28: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] -- 29: String -- 30: java[Qualified . lang][Qualified . String] -- 31: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] -- 32: -- 33: Positions -- 34: Comments -- 35: Attributes -+ 19: WitnessNames -+ 20: annotation -+ 21: scala[Qualified . annotation] -+ 22: internal -+ 23: scala[Qualified . annotation][Qualified . internal] -+ 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] -+ 25: collection -+ 26: scala[Qualified . collection] -+ 27: immutable -+ 28: scala[Qualified . collection][Qualified . immutable] -+ 29: Seq -+ 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] -+ 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] -+ 32: String -+ 33: evidence$1 -+ 34: evidence$ -+ 35: [Unique evidence$ 1] -+ 36: ??? -+ 37: Predef -+ 38: SourceFile -+ 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] -+ 40: java[Qualified . lang][Qualified . String] -+ 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] -+ 42: -+ 43: Positions -+ 44: Comments -+ 45: Attributes - --Trees (98 bytes, starting from ): -- 0: PACKAGE(96) -+Trees (122 bytes, starting from ): -+ 0: PACKAGE(120) - 2: TERMREFpkg 1 [] - 4: IMPORT(4) - 6: TERMREFpkg 4 [scala[Qualified . reflect]] - 8: IMPORTED 5 [ClassTag] -- 10: TYPEDEF(86) 6 [Foo] -- 13: TEMPLATE(65) -+ 10: TYPEDEF(110) 6 [Foo] -+ 13: TEMPLATE(89) - 15: APPLY(10) - 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] - 20: NEW -@@ -60,39 +70,51 @@ Trees (98 bytes, starting from ): - 31: TYPEREF 14 [Unit] - 33: TERMREFpkg 2 [scala] - 35: STABLE -- 36: DEFDEF(42) 15 [mkArray] -- 39: TYPEPARAM(11) 16 [T] -+ 36: DEFDEF(66) 15 [mkArray] -+ 39: TYPEPARAM(35) 16 [T] - 42: TYPEBOUNDStpt(8) - 44: TYPEREF 17 [Nothing] - 46: SHAREDtype 33 - 48: TYPEREF 18 [Any] - 50: SHAREDtype 33 -- 52: PARAM(14) 20 [[Unique evidence$ 1]] -- 55: APPLIEDtpt(10) -- 57: IDENTtpt 5 [ClassTag] -- 59: TYPEREF 5 [ClassTag] -- 61: SHAREDtype 6 -- 63: IDENTtpt 16 [T] -- 65: TYPEREFdirect 39 -- 67: GIVEN -- 68: IDENTtpt 17 [Nothing] -- 70: TYPEREF 17 [Nothing] -- 72: TERMREFpkg 2 [scala] -- 74: TERMREF 21 [???] -- 76: TERMREF 22 [Predef] -- 78: SHAREDtype 33 -- 80: ANNOTATION(16) -- 82: TYPEREF 23 [SourceFile] -- 84: TERMREFpkg 27 [scala[Qualified . annotation][Qualified . internal]] -- 86: APPLY(10) -- 88: SELECTin(6) 31 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] -- 91: NEW -- 92: SHAREDtype 82 -- 94: SHAREDtype 82 -- 96: STRINGconst 32 [] -- 98: -+ 52: ANNOTATION(22) -+ 54: TYPEREF 19 [WitnessNames] -+ 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] -+ 58: APPLY(16) -+ 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] -+ 63: NEW -+ 64: SHAREDtype 54 -+ 66: SHAREDtype 54 -+ 68: REPEATED(6) -+ 70: TYPEREF 32 [String] -+ 72: SHAREDtype 23 -+ 74: STRINGconst 33 [evidence$1] -+ 76: PARAM(14) 35 [[Unique evidence$ 1]] -+ 79: APPLIEDtpt(10) -+ 81: IDENTtpt 5 [ClassTag] -+ 83: TYPEREF 5 [ClassTag] -+ 85: SHAREDtype 6 -+ 87: IDENTtpt 16 [T] -+ 89: TYPEREFdirect 39 -+ 91: GIVEN -+ 92: IDENTtpt 17 [Nothing] -+ 94: TYPEREF 17 [Nothing] -+ 96: TERMREFpkg 2 [scala] -+ 98: TERMREF 36 [???] -+ 100: TERMREF 37 [Predef] -+ 102: SHAREDtype 33 -+ 104: ANNOTATION(16) -+ 106: TYPEREF 38 [SourceFile] -+ 108: SHAREDtype 56 -+ 110: APPLY(10) -+ 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] -+ 115: NEW -+ 116: SHAREDtype 106 -+ 118: SHAREDtype 106 -+ 120: STRINGconst 42 [] -+ 122: - --Positions (75 bytes, starting from ): -+Positions (83 bytes, starting from ): - lines: 7 - line sizes: - 38, 0, 23, 0, 10, 41, 0 -@@ -110,17 +132,20 @@ Positions (75 bytes, starting from ): - 39: 90 .. 101 - 44: 93 .. 93 - 48: 93 .. 93 -- 52: 93 .. 101 -- 57: 93 .. 101 -- 63: 93 .. 101 -- 68: 104 .. 111 -- 74: 114 .. 117 -- 86: 65 .. 117 -- 92: 65 .. 65 -- 96: 65 .. 65 -+ 64: 90 .. 90 -+ 70: 90 .. 90 -+ 74: 90 .. 90 -+ 76: 93 .. 101 -+ 81: 93 .. 101 -+ 87: 93 .. 101 -+ 92: 104 .. 111 -+ 98: 114 .. 117 -+ 110: 65 .. 117 -+ 116: 65 .. 65 -+ 120: 65 .. 65 - - source paths: -- 0: 32 [] -+ 0: 42 [] - - Attributes (2 bytes, starting from ): -- SOURCEFILEattr 32 [] -+ SOURCEFILEattr 42 [] -``` - -### One type checking error involving Selectable: -- tests/pos/i2997.scala - -test: -```scala -case class Foo[T <: Int with Singleton](t : T) - -object Test { - val one = 1 - final val final_one = 1 - val a : 1 = Foo(1).t - val b : one.type = Foo(one).t - val c : 1 = Foo(final_one).t -} -``` - -error: -```scala --- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 ---------------------- -6 | val a : 1 = Foo(1).t - | ^^^^^^ - | Found: Foo[(1 : Int)]{val t: (1 : Int)} - | Required: Selectable | Dynamic - | - | The following import might fix the problem: - | - | import scala.reflect.Selectable.reflectiveSelectable - | - | - | longer explanation available when compiling with `-explain` -``` - -`tracked`-less reproduction: -```scala -case class Foo(t : Int) - -object Foo { - def apply(t0: Int) : Foo {val t : t0.type} = ??? -} - -object Test { - val a : 1 = Foo(1).t -} -``` \ No newline at end of file diff --git a/simple-tracked-inference-failures-edited.md b/simple-tracked-inference-failures-edited.md deleted file mode 100644 index ab142879b08d..000000000000 --- a/simple-tracked-inference-failures-edited.md +++ /dev/null @@ -1,388 +0,0 @@ -sbt:scala3> testCompilation -[info] Test run dotty.tools.dotc.CompilationTests started -[info] Test dotty.tools.dotc.CompilationTests.parallelBackend started -[info] Test dotty.tools.dotc.CompilationTests.negAll started -[error] Test dotty.tools.dotc.CompilationTests.negAll failed: java.lang.AssertionError: Neg test should have failed, but did not, took 61.516 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkExpectedErrors(ParallelTesting.scala:1218) -[error] at dotty.tools.dotc.CompilationTests.negAll(CompilationTests.scala:160) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.runAll started -[=======================================>] completed (1723/1723, 0 failed, 69s) -[info] Test dotty.tools.dotc.CompilationTests.pickling started -[======> ] completed (893/4754, 0 failed, 10s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- -5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- -6 |case class Bar[A](@Ann[A] foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i12953.scala' -[=====================> ] completed (2655/4754, 1 failed, 31s)Compilation failed for: 'tests/pos/i2997.scala' --- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- -6 | val a : 1 = Foo(1).t - | ^^^^^^ - | Found: Foo[(1 : scala.Int)]{val t: (1 : scala.Int)} - | Required: scala.Selectable | scala.Dynamic - | - | The following import might fix the problem: - | - | import scala.reflect.Selectable.reflectiveSelectable - | - | - | longer explanation available when compiling with `-explain` -[=========================> ] completed (3119/4754, 2 failed, 36s)Fatal compiler crash when compiling: tests/pos/i20901: -TASTy printer difference for class Foo in tests/pos/i20901/Foo.scala, did not match tests/pos/i20901/Foo.tastycheck, - output dumped in after-printing.txt, check diff with `git diff --no-index -- tests/pos/i20901/Foo.tastycheck after-printing.txt` - actual output: -Header: - version: - tooling: - UUID: - -Names (351 bytes, starting from ): - 0: ASTs - 1: - 2: scala - 3: reflect - 4: scala[Qualified . reflect] - 5: ClassTag - 6: Foo - 7: - 8: java - 9: lang - 10: java[Qualified . lang] - 11: Object - 12: java[Qualified . lang][Qualified . Object] - 13: [Signed Signature(List(),java.lang.Object) @] - 14: Unit - 15: mkArray - 16: T - 17: Nothing - 18: Any - 19: WitnessNames - 20: annotation - 21: scala[Qualified . annotation] - 22: internal - 23: scala[Qualified . annotation][Qualified . internal] - 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] - 25: collection - 26: scala[Qualified . collection] - 27: immutable - 28: scala[Qualified . collection][Qualified . immutable] - 29: Seq - 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] - 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] - 32: String - 33: evidence$1 - 34: evidence$ - 35: [Unique evidence$ 1] - 36: ??? - 37: Predef - 38: SourceFile - 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] - 40: java[Qualified . lang][Qualified . String] - 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] - 42: - 43: Positions - 44: Comments - 45: Attributes - -Trees (122 bytes, starting from ): - 0: PACKAGE(120) - 2: TERMREFpkg 1 [] - 4: IMPORT(4) - 6: TERMREFpkg 4 [scala[Qualified . reflect]] - 8: IMPORTED 5 [ClassTag] - 10: TYPEDEF(110) 6 [Foo] - 13: TEMPLATE(89) - 15: APPLY(10) - 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] - 20: NEW - 21: TYPEREF 11 [Object] - 23: TERMREFpkg 10 [java[Qualified . lang]] - 25: SHAREDtype 21 - 27: DEFDEF(7) 7 [] - 30: EMPTYCLAUSE - 31: TYPEREF 14 [Unit] - 33: TERMREFpkg 2 [scala] - 35: STABLE - 36: DEFDEF(66) 15 [mkArray] - 39: TYPEPARAM(35) 16 [T] - 42: TYPEBOUNDStpt(8) - 44: TYPEREF 17 [Nothing] - 46: SHAREDtype 33 - 48: TYPEREF 18 [Any] - 50: SHAREDtype 33 - 52: ANNOTATION(22) - 54: TYPEREF 19 [WitnessNames] - 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] - 58: APPLY(16) - 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] - 63: NEW - 64: SHAREDtype 54 - 66: SHAREDtype 54 - 68: REPEATED(6) - 70: TYPEREF 32 [String] - 72: SHAREDtype 23 - 74: STRINGconst 33 [evidence$1] - 76: PARAM(14) 35 [[Unique evidence$ 1]] - 79: APPLIEDtpt(10) - 81: IDENTtpt 5 [ClassTag] - 83: TYPEREF 5 [ClassTag] - 85: SHAREDtype 6 - 87: IDENTtpt 16 [T] - 89: TYPEREFdirect 39 - 91: GIVEN - 92: IDENTtpt 17 [Nothing] - 94: TYPEREF 17 [Nothing] - 96: TERMREFpkg 2 [scala] - 98: TERMREF 36 [???] - 100: TERMREF 37 [Predef] - 102: SHAREDtype 33 - 104: ANNOTATION(16) - 106: TYPEREF 38 [SourceFile] - 108: SHAREDtype 56 - 110: APPLY(10) - 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] - 115: NEW - 116: SHAREDtype 106 - 118: SHAREDtype 106 - 120: STRINGconst 42 [] - 122: - -Positions (83 bytes, starting from ): - lines: 7 - line sizes: - 38, 0, 23, 0, 10, 41, 0 - positions: - 0: 40 .. 117 - 4: 40 .. 63 - 6: 47 .. 54 - 8: 55 .. 63 - 10: 65 .. 117 - 13: 78 .. 117 - 21: 71 .. 71 - 27: 78 .. 78 - 31: 78 .. 78 - 36: 78 .. 117 - 39: 90 .. 101 - 44: 93 .. 93 - 48: 93 .. 93 - 64: 90 .. 90 - 70: 90 .. 90 - 74: 90 .. 90 - 76: 93 .. 101 - 81: 93 .. 101 - 87: 93 .. 101 - 92: 104 .. 111 - 98: 114 .. 117 - 110: 65 .. 117 - 116: 65 .. 65 - 120: 65 .. 65 - - source paths: - 0: 42 [] - -Attributes (2 bytes, starting from ): - SOURCEFILEattr 42 [] - at dotty.tools.dotc.reporting.ThrowingReporter.doReport(ThrowingReporter.scala:14) - at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:160) - at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:191) - at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:210) - at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:213) - at dotty.tools.dotc.report$.error(report.scala:69) - at dotty.tools.dotc.transform.Pickler.testSamePrinted$$anonfun$1(Pickler.scala:482) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.Option.foreach(Option.scala:437) - at dotty.tools.dotc.transform.Pickler.testSamePrinted(Pickler.scala:477) - at dotty.tools.dotc.transform.Pickler.testUnpickler$$anonfun$2(Pickler.scala:456) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619) - at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617) - at scala.collection.AbstractIterable.foreach(Iterable.scala:935) - at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:905) - at dotty.tools.dotc.transform.Pickler.testUnpickler(Pickler.scala:442) - at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:412) - at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:367) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1324) - at dotty.tools.dotc.Run.runPhases$1(Run.scala:360) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:407) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:407) - at scala.Function0.apply$mcV$sp(Function0.scala:42) - at dotty.tools.dotc.Run.showProgress(Run.scala:469) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:407) - at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:419) - at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69) - at dotty.tools.dotc.Run.compileUnits(Run.scala:419) - at dotty.tools.dotc.Run.compileSources(Run.scala:306) - at dotty.tools.dotc.Run.compile(Run.scala:291) - at dotty.tools.dotc.Driver.doCompile(Driver.scala:37) - at dotty.tools.dotc.Driver.process(Driver.scala:201) - at dotty.tools.dotc.Driver.process(Driver.scala:169) - at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:564) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:261) - at scala.collection.immutable.List.map(List.scala:247) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:259) - at scala.util.Try$.apply(Try.scala:217) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:264) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$1(ParallelTesting.scala:295) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:298) - at scala.Function0.apply$mcV$sp(Function0.scala:42) - at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:482) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource(ParallelTesting.scala:298) - at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:378) - at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:360) - at dotty.tools.vulpix.ParallelTesting$$anon$3.run(ParallelTesting.scala:293) - at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375) - at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) - at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) - at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) - at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) - at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) -[=======================================>] completed (4754/4754, 3 failed, 76s) -[error] Test dotty.tools.dotc.CompilationTests.pickling failed: java.lang.AssertionError: Pos test failed, but should not, reasons: -[error] encountered 3 test failure(s): -[error] - generic failure (see test output), took 77.724 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) -[error] at dotty.tools.dotc.CompilationTests.pickling(CompilationTests.scala:195) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.rewrites started -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (24/24, 0 failed, 1s) -[info] Test dotty.tools.dotc.CompilationTests.pos started -[==> ] completed (273/3538, 0 failed, 6s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- -5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- -6 |case class Bar[A](@Ann[A] foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i12953.scala' -[========> ] completed (825/3538, 1 failed, 16s)-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- -6 | val a : 1 = Foo(1).t - | ^^^^^^ - | Found: Foo[(1 : Int)]{val t: (1 : Int)} - | Required: Selectable | Dynamic - | - | The following import might fix the problem: - | - | import scala.reflect.Selectable.reflectiveSelectable - | - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i2997.scala' -[=======================================>] completed (3538/3538, 2 failed, 92s) -[error] Test dotty.tools.dotc.CompilationTests.pos failed: java.lang.AssertionError: Pos test failed, but should not, reasons: -[error] encountered 2 test failure(s): -[error] - generic failure (see test output), took 93.413 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) -[error] at dotty.tools.dotc.CompilationTests.pos(CompilationTests.scala:55) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.warn started -[=======================================>] completed (275/275, 0 failed, 5s) -[info] Test dotty.tools.dotc.CompilationTests.posCC started -[=======================================>] completed (149/149, 0 failed, 2s) -[info] Test dotty.tools.dotc.CompilationTests.checkInit started -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (149/149, 0 failed, 1s) -[=======================================>] completed (59/59, 0 failed, 0s) -[=======================================>] completed (25/25, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.posTwice started -[=======================================>] completed (133/133, 0 failed, 11s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsNeg started -[=======================================>] completed (73/73, 0 failed, 3s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsPos started -[=======================================>] completed (98/98, 0 failed, 5s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsRun started -[=======================================>] completed (12/12, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.checkInitGlobal started -[=======================================>] completed (56/56, 0 failed, 0s) -[=======================================>] completed (48/48, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.fuzzyAll started -[=======================================>] completed (184/184, 0 failed, 2s) -[info] Test dotty.tools.dotc.CompilationTests.genericJavaSignatures started -[=======================================>] completed (26/26, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsWarn started -[=======================================>] completed (2/2, 0 failed, 0s) - -================================================================================ -Test Report -================================================================================ - -51 suites passed, 3 failed, 54 total - tests/pos/i12953.scala failed - tests/pos/i2997.scala failed - tests/pos/i20901 failed - --------------------------------------------------------------------------------- -Note - reproduction instructions have been dumped to log file: - /home/kpi/scala3/testlogs/tests-2025-04-14/tests-2025-04-14-T09-36-43.log --------------------------------------------------------------------------------- -[info] Test run dotty.tools.dotc.CompilationTests finished: 3 failed, 0 ignored, 17 total, 364.817s -[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests started -[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests finished: 0 failed, 0 ignored, 0 total, 0.0s -[info] Test run dotty.tools.dotc.coverage.CoverageTests started -[info] Test run dotty.tools.dotc.coverage.CoverageTests finished: 0 failed, 0 ignored, 0 total, 0.0s -[error] Failed: Total 17, Failed 3, Errors 0, Passed 14 -[error] Failed tests: -[error] dotty.tools.dotc.CompilationTests -[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful -[error] Total time: 367 s (06:07), completed Apr 14, 2025, 9:40:05 AM diff --git a/simple-tracked-inference-failures.md b/simple-tracked-inference-failures.md deleted file mode 100644 index 55b390421eb7..000000000000 --- a/simple-tracked-inference-failures.md +++ /dev/null @@ -1,492 +0,0 @@ -sbt:scala3> testCompilation -[info] Test run dotty.tools.dotc.CompilationTests started -[info] Test dotty.tools.dotc.CompilationTests.parallelBackend started -[ ] completed (0/7, 0 failed, 2s)[warn] Metals requires the semanticdb compiler plugin -[warn] consider setting 'Global / semanticdbEnabled := true' in your global sbt settings ($HOME/.sbt/1.0) -[=======================================>] completed (7/7, 0 failed, 18s) -[=======================================>] completed (2/2, 0 failed, 0s) -[=======================================>] completed (2/2, 0 failed, 2s) -[info] Test dotty.tools.dotc.CompilationTests.negAll started -[===> ] completed (233/1928, 0 failed, 8s) -No errors found when compiling neg test tests/neg/experimental-nested-imports-2.scala -[====> ] completed (257/1928, 1 failed, 8s) -No errors found when compiling neg test tests/neg/experimentalDefaultParams.scala -[=====> ] completed (300/1928, 2 failed, 10s) -No errors found when compiling neg test tests/neg/expeimental-flag.scala -[========> ] completed (449/1928, 3 failed, 14s) -No errors found when compiling neg test tests/neg/experimental.scala -[=========> ] completed (489/1928, 4 failed, 14s) -No errors found when compiling neg test tests/neg/experimentalTypes2.scala -[==========> ] completed (537/1928, 5 failed, 16s) -No errors found when compiling neg test tests/neg/experimental-message.scala -[============> ] completed (649/1928, 6 failed, 18s) -No errors found when compiling neg test tests/neg/experimental-nested-imports-3.scala -[============> ] completed (671/1928, 7 failed, 18s) -No errors found when compiling neg test tests/neg/i13848.scala -[=============> ] completed (687/1928, 8 failed, 19s) -No errors found when compiling neg test tests/neg/experimentalUnapply.scala -[=============> ] completed (696/1928, 9 failed, 19s) -No errors found when compiling neg test tests/neg/experimentalType.scala -[===============> ] completed (779/1928, 10 failed, 21s) -No errors found when compiling neg test tests/neg/experimentalTests.scala -[================> ] completed (852/1928, 11 failed, 22s) -No errors found when compiling neg test tests/neg/experimental-nested-imports.scala -[=================> ] completed (889/1928, 12 failed, 23s) -No errors found when compiling neg test tests/neg/14034.scala - -No errors found when compiling neg test tests/neg/experimentalAnnot.scala -[=================> ] completed (908/1928, 14 failed, 23s) -No errors found when compiling neg test tests/neg/experimentalInline.scala -[==================> ] completed (946/1928, 15 failed, 24s) -No errors found when compiling neg test tests/neg/experimentalSignature.scala -[===================> ] completed (969/1928, 16 failed, 24s) -No errors found when compiling neg test tests/neg/experimentalInline2.scala -[===================> ] completed (996/1928, 17 failed, 25s) -No errors found when compiling neg test tests/neg/experimentalCaseClass.scala -[=====================> ] completed (1067/1928, 18 failed, 27s) -No errors found when compiling neg test tests/neg/experimentalMembers.scala - -No errors found when compiling neg test tests/neg/tracked2.scala -[=====================> ] completed (1082/1928, 20 failed, 27s) -No errors found when compiling neg test tests/neg/experimentalTypeRHS.scala - -No errors found when compiling neg test tests/neg/i13091.scala -[=====================> ] completed (1094/1928, 22 failed, 27s) -No errors found when compiling neg test tests/neg/i17292.scala -[======================> ] completed (1121/1928, 23 failed, 28s) -No errors found when compiling neg test tests/neg/experimentalEnum.scala -[==========================> ] completed (1348/1928, 24 failed, 33s) -No errors found when compiling neg test tests/neg/experimentalOverride.scala - -No errors found when compiling neg test tests/neg/experimental-imports.scala -[===========================> ] completed (1386/1928, 26 failed, 33s) -No errors found when compiling neg test tests/neg/i17292b.scala -[============================> ] completed (1427/1928, 27 failed, 34s) -No errors found when compiling neg test tests/neg/use-experimental-def.scala -[=============================> ] completed (1459/1928, 28 failed, 35s) -No errors found when compiling neg test tests/neg/experimentalRHS.scala -[==============================> ] completed (1497/1928, 29 failed, 36s) -No errors found when compiling neg test tests/neg/experimentalSam.scala -[==============================> ] completed (1516/1928, 30 failed, 36s) -No errors found when compiling neg test tests/neg/experimentalTerms.scala -[=================================> ] completed (1669/1928, 31 failed, 42s) -No errors found when compiling neg test neg/experimental-message-experimental-flag -[=======================================>] completed (1928/1928, 32 failed, 61s) -[error] Test dotty.tools.dotc.CompilationTests.negAll failed: java.lang.AssertionError: Neg test should have failed, but did not, took 61.516 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkExpectedErrors(ParallelTesting.scala:1218) -[error] at dotty.tools.dotc.CompilationTests.negAll(CompilationTests.scala:160) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.runAll started -[=======================================>] completed (1723/1723, 0 failed, 69s) -[info] Test dotty.tools.dotc.CompilationTests.pickling started -[======> ] completed (893/4754, 0 failed, 10s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- -5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- -6 |case class Bar[A](@Ann[A] foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i12953.scala' -[=====================> ] completed (2655/4754, 1 failed, 31s)Compilation failed for: 'tests/pos/i2997.scala' --- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- -6 | val a : 1 = Foo(1).t - | ^^^^^^ - | Found: Foo[(1 : scala.Int)]{val t: (1 : scala.Int)} - | Required: scala.Selectable | scala.Dynamic - | - | The following import might fix the problem: - | - | import scala.reflect.Selectable.reflectiveSelectable - | - | - | longer explanation available when compiling with `-explain` -[=========================> ] completed (3119/4754, 2 failed, 36s)Fatal compiler crash when compiling: tests/pos/i20901: -TASTy printer difference for class Foo in tests/pos/i20901/Foo.scala, did not match tests/pos/i20901/Foo.tastycheck, - output dumped in after-printing.txt, check diff with `git diff --no-index -- tests/pos/i20901/Foo.tastycheck after-printing.txt` - actual output: -Header: - version: - tooling: - UUID: - -Names (351 bytes, starting from ): - 0: ASTs - 1: - 2: scala - 3: reflect - 4: scala[Qualified . reflect] - 5: ClassTag - 6: Foo - 7: - 8: java - 9: lang - 10: java[Qualified . lang] - 11: Object - 12: java[Qualified . lang][Qualified . Object] - 13: [Signed Signature(List(),java.lang.Object) @] - 14: Unit - 15: mkArray - 16: T - 17: Nothing - 18: Any - 19: WitnessNames - 20: annotation - 21: scala[Qualified . annotation] - 22: internal - 23: scala[Qualified . annotation][Qualified . internal] - 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] - 25: collection - 26: scala[Qualified . collection] - 27: immutable - 28: scala[Qualified . collection][Qualified . immutable] - 29: Seq - 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] - 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] - 32: String - 33: evidence$1 - 34: evidence$ - 35: [Unique evidence$ 1] - 36: ??? - 37: Predef - 38: SourceFile - 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] - 40: java[Qualified . lang][Qualified . String] - 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] - 42: - 43: Positions - 44: Comments - 45: Attributes - -Trees (122 bytes, starting from ): - 0: PACKAGE(120) - 2: TERMREFpkg 1 [] - 4: IMPORT(4) - 6: TERMREFpkg 4 [scala[Qualified . reflect]] - 8: IMPORTED 5 [ClassTag] - 10: TYPEDEF(110) 6 [Foo] - 13: TEMPLATE(89) - 15: APPLY(10) - 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] - 20: NEW - 21: TYPEREF 11 [Object] - 23: TERMREFpkg 10 [java[Qualified . lang]] - 25: SHAREDtype 21 - 27: DEFDEF(7) 7 [] - 30: EMPTYCLAUSE - 31: TYPEREF 14 [Unit] - 33: TERMREFpkg 2 [scala] - 35: STABLE - 36: DEFDEF(66) 15 [mkArray] - 39: TYPEPARAM(35) 16 [T] - 42: TYPEBOUNDStpt(8) - 44: TYPEREF 17 [Nothing] - 46: SHAREDtype 33 - 48: TYPEREF 18 [Any] - 50: SHAREDtype 33 - 52: ANNOTATION(22) - 54: TYPEREF 19 [WitnessNames] - 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] - 58: APPLY(16) - 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] - 63: NEW - 64: SHAREDtype 54 - 66: SHAREDtype 54 - 68: REPEATED(6) - 70: TYPEREF 32 [String] - 72: SHAREDtype 23 - 74: STRINGconst 33 [evidence$1] - 76: PARAM(14) 35 [[Unique evidence$ 1]] - 79: APPLIEDtpt(10) - 81: IDENTtpt 5 [ClassTag] - 83: TYPEREF 5 [ClassTag] - 85: SHAREDtype 6 - 87: IDENTtpt 16 [T] - 89: TYPEREFdirect 39 - 91: GIVEN - 92: IDENTtpt 17 [Nothing] - 94: TYPEREF 17 [Nothing] - 96: TERMREFpkg 2 [scala] - 98: TERMREF 36 [???] - 100: TERMREF 37 [Predef] - 102: SHAREDtype 33 - 104: ANNOTATION(16) - 106: TYPEREF 38 [SourceFile] - 108: SHAREDtype 56 - 110: APPLY(10) - 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] - 115: NEW - 116: SHAREDtype 106 - 118: SHAREDtype 106 - 120: STRINGconst 42 [] - 122: - -Positions (83 bytes, starting from ): - lines: 7 - line sizes: - 38, 0, 23, 0, 10, 41, 0 - positions: - 0: 40 .. 117 - 4: 40 .. 63 - 6: 47 .. 54 - 8: 55 .. 63 - 10: 65 .. 117 - 13: 78 .. 117 - 21: 71 .. 71 - 27: 78 .. 78 - 31: 78 .. 78 - 36: 78 .. 117 - 39: 90 .. 101 - 44: 93 .. 93 - 48: 93 .. 93 - 64: 90 .. 90 - 70: 90 .. 90 - 74: 90 .. 90 - 76: 93 .. 101 - 81: 93 .. 101 - 87: 93 .. 101 - 92: 104 .. 111 - 98: 114 .. 117 - 110: 65 .. 117 - 116: 65 .. 65 - 120: 65 .. 65 - - source paths: - 0: 42 [] - -Attributes (2 bytes, starting from ): - SOURCEFILEattr 42 [] - at dotty.tools.dotc.reporting.ThrowingReporter.doReport(ThrowingReporter.scala:14) - at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:160) - at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:191) - at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:210) - at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:213) - at dotty.tools.dotc.report$.error(report.scala:69) - at dotty.tools.dotc.transform.Pickler.testSamePrinted$$anonfun$1(Pickler.scala:482) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.Option.foreach(Option.scala:437) - at dotty.tools.dotc.transform.Pickler.testSamePrinted(Pickler.scala:477) - at dotty.tools.dotc.transform.Pickler.testUnpickler$$anonfun$2(Pickler.scala:456) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619) - at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617) - at scala.collection.AbstractIterable.foreach(Iterable.scala:935) - at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:905) - at dotty.tools.dotc.transform.Pickler.testUnpickler(Pickler.scala:442) - at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:412) - at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:367) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) - at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) - at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1324) - at dotty.tools.dotc.Run.runPhases$1(Run.scala:360) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:407) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:407) - at scala.Function0.apply$mcV$sp(Function0.scala:42) - at dotty.tools.dotc.Run.showProgress(Run.scala:469) - at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:407) - at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:419) - at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69) - at dotty.tools.dotc.Run.compileUnits(Run.scala:419) - at dotty.tools.dotc.Run.compileSources(Run.scala:306) - at dotty.tools.dotc.Run.compile(Run.scala:291) - at dotty.tools.dotc.Driver.doCompile(Driver.scala:37) - at dotty.tools.dotc.Driver.process(Driver.scala:201) - at dotty.tools.dotc.Driver.process(Driver.scala:169) - at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:564) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:261) - at scala.collection.immutable.List.map(List.scala:247) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:259) - at scala.util.Try$.apply(Try.scala:217) - at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:264) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$1(ParallelTesting.scala:295) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:298) - at scala.Function0.apply$mcV$sp(Function0.scala:42) - at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:482) - at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource(ParallelTesting.scala:298) - at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:378) - at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:360) - at dotty.tools.vulpix.ParallelTesting$$anon$3.run(ParallelTesting.scala:293) - at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375) - at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) - at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) - at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) - at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) - at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) -[=======================================>] completed (4754/4754, 3 failed, 76s) -[error] Test dotty.tools.dotc.CompilationTests.pickling failed: java.lang.AssertionError: Pos test failed, but should not, reasons: -[error] encountered 3 test failure(s): -[error] - generic failure (see test output), took 77.724 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) -[error] at dotty.tools.dotc.CompilationTests.pickling(CompilationTests.scala:195) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.rewrites started -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (24/24, 0 failed, 1s) -[info] Test dotty.tools.dotc.CompilationTests.pos started -[==> ] completed (273/3538, 0 failed, 6s)-- [E006] Not Found Error: tests/pos/i12953.scala:5:39 ----------------------------------------------------------------- -5 |case class Foo[A](@Schema(classOf[List[A]]) foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/pos/i12953.scala:6:23 ----------------------------------------------------------------- -6 |case class Bar[A](@Ann[A] foo: String) - | ^ - | Not found: type A - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i12953.scala' -[========> ] completed (825/3538, 1 failed, 16s)-- [E007] Type Mismatch Error: tests/pos/i2997.scala:6:17 -------------------------------------------------------------- -6 | val a : 1 = Foo(1).t - | ^^^^^^ - | Found: Foo[(1 : Int)]{val t: (1 : Int)} - | Required: Selectable | Dynamic - | - | The following import might fix the problem: - | - | import scala.reflect.Selectable.reflectiveSelectable - | - | - | longer explanation available when compiling with `-explain` -Compilation failed for: 'tests/pos/i2997.scala' -[=======================================>] completed (3538/3538, 2 failed, 92s) -[error] Test dotty.tools.dotc.CompilationTests.pos failed: java.lang.AssertionError: Pos test failed, but should not, reasons: -[error] encountered 2 test failure(s): -[error] - generic failure (see test output), took 93.413 sec -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1269) -[error] at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkCompile(ParallelTesting.scala:1185) -[error] at dotty.tools.dotc.CompilationTests.pos(CompilationTests.scala:55) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) -[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) -[error] at java.lang.reflect.Method.invoke(Method.java:569) -[error] ... -[info] Test dotty.tools.dotc.CompilationTests.warn started -[=======================================>] completed (275/275, 0 failed, 5s) -[info] Test dotty.tools.dotc.CompilationTests.posCC started -[=======================================>] completed (149/149, 0 failed, 2s) -[info] Test dotty.tools.dotc.CompilationTests.checkInit started -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (149/149, 0 failed, 1s) -[=======================================>] completed (59/59, 0 failed, 0s) -[=======================================>] completed (25/25, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[=======================================>] completed (1/1, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.posTwice started -[=======================================>] completed (133/133, 0 failed, 11s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsNeg started -[=======================================>] completed (73/73, 0 failed, 3s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsPos started -[=======================================>] completed (98/98, 0 failed, 5s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsRun started -[=======================================>] completed (12/12, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.checkInitGlobal started -[=======================================>] completed (56/56, 0 failed, 0s) -[=======================================>] completed (48/48, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.fuzzyAll started -[=======================================>] completed (184/184, 0 failed, 2s) -[info] Test dotty.tools.dotc.CompilationTests.genericJavaSignatures started -[=======================================>] completed (26/26, 0 failed, 0s) -[info] Test dotty.tools.dotc.CompilationTests.explicitNullsWarn started -[=======================================>] completed (2/2, 0 failed, 0s) - -================================================================================ -Test Report -================================================================================ - -51 suites passed, 3 failed, 54 total - tests/neg/experimentalEnum.scala failed - tests/neg/experimental.scala failed - tests/neg/experimentalSam.scala failed - tests/neg/experimentalRHS.scala failed - tests/neg/experimental-nested-imports.scala failed - tests/neg/use-experimental-def.scala failed - tests/neg/experimentalDefaultParams.scala failed - tests/neg/i17292b.scala failed - tests/neg/experimental-message-experimental-flag failed - tests/neg/tracked2.scala failed - tests/neg/experimentalUnapply.scala failed - tests/neg/14034.scala failed - tests/neg/experimental-nested-imports-2.scala failed - tests/neg/experimentalSignature.scala failed - tests/neg/experimental-imports.scala failed - tests/neg/i13091.scala failed - tests/neg/i17292.scala failed - tests/neg/experimental-nested-imports-3.scala failed - tests/neg/i13848.scala failed - tests/neg/experimentalMembers.scala failed - tests/neg/experimentalType.scala failed - tests/neg/experimentalTypeRHS.scala failed - tests/neg/experimentalTests.scala failed - tests/neg/experimentalInline2.scala failed - tests/neg/experimentalTerms.scala failed - tests/neg/experimentalTypes2.scala failed - tests/neg/experimentalAnnot.scala failed - tests/neg/experimentalCaseClass.scala failed - tests/neg/experimentalOverride.scala failed - tests/neg/expeimental-flag.scala failed - tests/neg/experimentalInline.scala failed - tests/neg/experimental-message.scala failed - tests/pos/i12953.scala failed - tests/pos/i2997.scala failed - tests/pos/i20901 failed - tests/pos/i12953.scala failed - tests/pos/i2997.scala failed - --------------------------------------------------------------------------------- -Note - reproduction instructions have been dumped to log file: - /home/kpi/scala3/testlogs/tests-2025-04-14/tests-2025-04-14-T09-36-43.log --------------------------------------------------------------------------------- -[info] Test run dotty.tools.dotc.CompilationTests finished: 3 failed, 0 ignored, 17 total, 364.817s -[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests started -[info] Test run dotty.tools.dotc.BootstrappedOnlyCompilationTests finished: 0 failed, 0 ignored, 0 total, 0.0s -[info] Test run dotty.tools.dotc.coverage.CoverageTests started -[info] Test run dotty.tools.dotc.coverage.CoverageTests finished: 0 failed, 0 ignored, 0 total, 0.0s -[error] Failed: Total 17, Failed 3, Errors 0, Passed 14 -[error] Failed tests: -[error] dotty.tools.dotc.CompilationTests -[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful -[error] Total time: 367 s (06:07), completed Apr 14, 2025, 9:40:05 AM From c0b27e4e596855f342072a679791493efd7a5fa4 Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Sun, 10 Aug 2025 17:19:34 +0200 Subject: [PATCH 05/11] Cleanup --- after-printing.txt | 151 ---------------------------------- tasty-fail-diff.txt | 187 ------------------------------------------ tests/pos/i2997.scala | 20 ++--- 3 files changed, 5 insertions(+), 353 deletions(-) delete mode 100644 after-printing.txt delete mode 100644 tasty-fail-diff.txt diff --git a/after-printing.txt b/after-printing.txt deleted file mode 100644 index 90cfcf8e9544..000000000000 --- a/after-printing.txt +++ /dev/null @@ -1,151 +0,0 @@ -Header: - version: - tooling: - UUID: - -Names (351 bytes, starting from ): - 0: ASTs - 1: - 2: scala - 3: reflect - 4: scala[Qualified . reflect] - 5: ClassTag - 6: Foo - 7: - 8: java - 9: lang - 10: java[Qualified . lang] - 11: Object - 12: java[Qualified . lang][Qualified . Object] - 13: [Signed Signature(List(),java.lang.Object) @] - 14: Unit - 15: mkArray - 16: T - 17: Nothing - 18: Any - 19: WitnessNames - 20: annotation - 21: scala[Qualified . annotation] - 22: internal - 23: scala[Qualified . annotation][Qualified . internal] - 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] - 25: collection - 26: scala[Qualified . collection] - 27: immutable - 28: scala[Qualified . collection][Qualified . immutable] - 29: Seq - 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] - 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] - 32: String - 33: evidence$1 - 34: evidence$ - 35: [Unique evidence$ 1] - 36: ??? - 37: Predef - 38: SourceFile - 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] - 40: java[Qualified . lang][Qualified . String] - 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] - 42: - 43: Positions - 44: Comments - 45: Attributes - -Trees (122 bytes, starting from ): - 0: PACKAGE(120) - 2: TERMREFpkg 1 [] - 4: IMPORT(4) - 6: TERMREFpkg 4 [scala[Qualified . reflect]] - 8: IMPORTED 5 [ClassTag] - 10: TYPEDEF(110) 6 [Foo] - 13: TEMPLATE(89) - 15: APPLY(10) - 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] - 20: NEW - 21: TYPEREF 11 [Object] - 23: TERMREFpkg 10 [java[Qualified . lang]] - 25: SHAREDtype 21 - 27: DEFDEF(7) 7 [] - 30: EMPTYCLAUSE - 31: TYPEREF 14 [Unit] - 33: TERMREFpkg 2 [scala] - 35: STABLE - 36: DEFDEF(66) 15 [mkArray] - 39: TYPEPARAM(35) 16 [T] - 42: TYPEBOUNDStpt(8) - 44: TYPEREF 17 [Nothing] - 46: SHAREDtype 33 - 48: TYPEREF 18 [Any] - 50: SHAREDtype 33 - 52: ANNOTATION(22) - 54: TYPEREF 19 [WitnessNames] - 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] - 58: APPLY(16) - 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] - 63: NEW - 64: SHAREDtype 54 - 66: SHAREDtype 54 - 68: REPEATED(6) - 70: TYPEREF 32 [String] - 72: SHAREDtype 23 - 74: STRINGconst 33 [evidence$1] - 76: PARAM(14) 35 [[Unique evidence$ 1]] - 79: APPLIEDtpt(10) - 81: IDENTtpt 5 [ClassTag] - 83: TYPEREF 5 [ClassTag] - 85: SHAREDtype 6 - 87: IDENTtpt 16 [T] - 89: TYPEREFdirect 39 - 91: GIVEN - 92: IDENTtpt 17 [Nothing] - 94: TYPEREF 17 [Nothing] - 96: TERMREFpkg 2 [scala] - 98: TERMREF 36 [???] - 100: TERMREF 37 [Predef] - 102: SHAREDtype 33 - 104: ANNOTATION(16) - 106: TYPEREF 38 [SourceFile] - 108: SHAREDtype 56 - 110: APPLY(10) - 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] - 115: NEW - 116: SHAREDtype 106 - 118: SHAREDtype 106 - 120: STRINGconst 42 [] - 122: - -Positions (83 bytes, starting from ): - lines: 7 - line sizes: - 38, 0, 23, 0, 10, 41, 0 - positions: - 0: 40 .. 117 - 4: 40 .. 63 - 6: 47 .. 54 - 8: 55 .. 63 - 10: 65 .. 117 - 13: 78 .. 117 - 21: 71 .. 71 - 27: 78 .. 78 - 31: 78 .. 78 - 36: 78 .. 117 - 39: 90 .. 101 - 44: 93 .. 93 - 48: 93 .. 93 - 64: 90 .. 90 - 70: 90 .. 90 - 74: 90 .. 90 - 76: 93 .. 101 - 81: 93 .. 101 - 87: 93 .. 101 - 92: 104 .. 111 - 98: 114 .. 117 - 110: 65 .. 117 - 116: 65 .. 65 - 120: 65 .. 65 - - source paths: - 0: 42 [] - -Attributes (2 bytes, starting from ): - SOURCEFILEattr 42 [] diff --git a/tasty-fail-diff.txt b/tasty-fail-diff.txt deleted file mode 100644 index a783034d6dd4..000000000000 --- a/tasty-fail-diff.txt +++ /dev/null @@ -1,187 +0,0 @@ -diff --git a/tests/pos/i20901/Foo.tastycheck b/after-printing.txt -index 82e95946f9..90cfcf8e95 100644 ---- a/tests/pos/i20901/Foo.tastycheck -+++ b/after-printing.txt -@@ -3,7 +3,7 @@ Header: - tooling: - UUID: - --Names (276 bytes, starting from ): -+Names (351 bytes, starting from ): - 0: ASTs - 1: - 2: scala -@@ -23,32 +23,42 @@ Names (276 bytes, starting from ): - 16: T - 17: Nothing - 18: Any -- 19: evidence$ -- 20: [Unique evidence$ 1] -- 21: ??? -- 22: Predef -- 23: SourceFile -- 24: annotation -- 25: scala[Qualified . annotation] -- 26: internal -- 27: scala[Qualified . annotation][Qualified . internal] -- 28: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] -- 29: String -- 30: java[Qualified . lang][Qualified . String] -- 31: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] -- 32: -- 33: Positions -- 34: Comments -- 35: Attributes -+ 19: WitnessNames -+ 20: annotation -+ 21: scala[Qualified . annotation] -+ 22: internal -+ 23: scala[Qualified . annotation][Qualified . internal] -+ 24: scala[Qualified . annotation][Qualified . internal][Qualified . WitnessNames] -+ 25: collection -+ 26: scala[Qualified . collection] -+ 27: immutable -+ 28: scala[Qualified . collection][Qualified . immutable] -+ 29: Seq -+ 30: scala[Qualified . collection][Qualified . immutable][Qualified . Seq] -+ 31: [Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @] -+ 32: String -+ 33: evidence$1 -+ 34: evidence$ -+ 35: [Unique evidence$ 1] -+ 36: ??? -+ 37: Predef -+ 38: SourceFile -+ 39: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile] -+ 40: java[Qualified . lang][Qualified . String] -+ 41: [Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @] -+ 42: -+ 43: Positions -+ 44: Comments -+ 45: Attributes - --Trees (98 bytes, starting from ): -- 0: PACKAGE(96) -+Trees (122 bytes, starting from ): -+ 0: PACKAGE(120) - 2: TERMREFpkg 1 [] - 4: IMPORT(4) - 6: TERMREFpkg 4 [scala[Qualified . reflect]] - 8: IMPORTED 5 [ClassTag] -- 10: TYPEDEF(86) 6 [Foo] -- 13: TEMPLATE(65) -+ 10: TYPEDEF(110) 6 [Foo] -+ 13: TEMPLATE(89) - 15: APPLY(10) - 17: SELECTin(8) 13 [[Signed Signature(List(),java.lang.Object) @]] - 20: NEW -@@ -60,39 +70,51 @@ Trees (98 bytes, starting from ): - 31: TYPEREF 14 [Unit] - 33: TERMREFpkg 2 [scala] - 35: STABLE -- 36: DEFDEF(42) 15 [mkArray] -- 39: TYPEPARAM(11) 16 [T] -+ 36: DEFDEF(66) 15 [mkArray] -+ 39: TYPEPARAM(35) 16 [T] - 42: TYPEBOUNDStpt(8) - 44: TYPEREF 17 [Nothing] - 46: SHAREDtype 33 - 48: TYPEREF 18 [Any] - 50: SHAREDtype 33 -- 52: PARAM(14) 20 [[Unique evidence$ 1]] -- 55: APPLIEDtpt(10) -- 57: IDENTtpt 5 [ClassTag] -- 59: TYPEREF 5 [ClassTag] -- 61: SHAREDtype 6 -- 63: IDENTtpt 16 [T] -- 65: TYPEREFdirect 39 -- 67: GIVEN -- 68: IDENTtpt 17 [Nothing] -- 70: TYPEREF 17 [Nothing] -- 72: TERMREFpkg 2 [scala] -- 74: TERMREF 21 [???] -- 76: TERMREF 22 [Predef] -- 78: SHAREDtype 33 -- 80: ANNOTATION(16) -- 82: TYPEREF 23 [SourceFile] -- 84: TERMREFpkg 27 [scala[Qualified . annotation][Qualified . internal]] -- 86: APPLY(10) -- 88: SELECTin(6) 31 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] -- 91: NEW -- 92: SHAREDtype 82 -- 94: SHAREDtype 82 -- 96: STRINGconst 32 [] -- 98: -+ 52: ANNOTATION(22) -+ 54: TYPEREF 19 [WitnessNames] -+ 56: TERMREFpkg 23 [scala[Qualified . annotation][Qualified . internal]] -+ 58: APPLY(16) -+ 60: SELECTin(6) 31 [[Signed Signature(List(scala.collection.immutable.Seq),scala.annotation.internal.WitnessNames) @]] -+ 63: NEW -+ 64: SHAREDtype 54 -+ 66: SHAREDtype 54 -+ 68: REPEATED(6) -+ 70: TYPEREF 32 [String] -+ 72: SHAREDtype 23 -+ 74: STRINGconst 33 [evidence$1] -+ 76: PARAM(14) 35 [[Unique evidence$ 1]] -+ 79: APPLIEDtpt(10) -+ 81: IDENTtpt 5 [ClassTag] -+ 83: TYPEREF 5 [ClassTag] -+ 85: SHAREDtype 6 -+ 87: IDENTtpt 16 [T] -+ 89: TYPEREFdirect 39 -+ 91: GIVEN -+ 92: IDENTtpt 17 [Nothing] -+ 94: TYPEREF 17 [Nothing] -+ 96: TERMREFpkg 2 [scala] -+ 98: TERMREF 36 [???] -+ 100: TERMREF 37 [Predef] -+ 102: SHAREDtype 33 -+ 104: ANNOTATION(16) -+ 106: TYPEREF 38 [SourceFile] -+ 108: SHAREDtype 56 -+ 110: APPLY(10) -+ 112: SELECTin(6) 41 [[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @]] -+ 115: NEW -+ 116: SHAREDtype 106 -+ 118: SHAREDtype 106 -+ 120: STRINGconst 42 [] -+ 122: - --Positions (75 bytes, starting from ): -+Positions (83 bytes, starting from ): - lines: 7 - line sizes: - 38, 0, 23, 0, 10, 41, 0 -@@ -110,17 +132,20 @@ Positions (75 bytes, starting from ): - 39: 90 .. 101 - 44: 93 .. 93 - 48: 93 .. 93 -- 52: 93 .. 101 -- 57: 93 .. 101 -- 63: 93 .. 101 -- 68: 104 .. 111 -- 74: 114 .. 117 -- 86: 65 .. 117 -- 92: 65 .. 65 -- 96: 65 .. 65 -+ 64: 90 .. 90 -+ 70: 90 .. 90 -+ 74: 90 .. 90 -+ 76: 93 .. 101 -+ 81: 93 .. 101 -+ 87: 93 .. 101 -+ 92: 104 .. 111 -+ 98: 114 .. 117 -+ 110: 65 .. 117 -+ 116: 65 .. 65 -+ 120: 65 .. 65 - - source paths: -- 0: 32 [] -+ 0: 42 [] - - Attributes (2 bytes, starting from ): -- SOURCEFILEattr 32 [] -+ SOURCEFILEattr 42 [] diff --git a/tests/pos/i2997.scala b/tests/pos/i2997.scala index b91b0f8cc085..6234889a88fd 100644 --- a/tests/pos/i2997.scala +++ b/tests/pos/i2997.scala @@ -1,19 +1,9 @@ -// case class Foo[T <: Int with Singleton](t : T) - -// object Test { -// val one = 1 -// final val final_one = 1 -// val a : 1 = Foo(1).t -// val b : one.type = Foo(one).t -// val c : 1 = Foo(final_one).t -// } - -case class Foo(t : Int) - -object Foo { - def apply(t0: Int) : Foo {val t : t0.type} = ??? -} +case class Foo[T <: Int with Singleton](t : T) object Test { + val one = 1 + final val final_one = 1 val a : 1 = Foo(1).t + val b : one.type = Foo(one).t + val c : 1 = Foo(final_one).t } From 822277ee6a45f5a1424588a052586b9e22b60439 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 10:04:29 +0800 Subject: [PATCH 06/11] Allow annotations for parameters that get inferred tracked --- .../src/dotty/tools/dotc/typer/Namer.scala | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index ae7d9a2a2cbc..4e7af9c57d20 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -830,6 +830,11 @@ class Namer { typer: Typer => def setNotNullInfos(infos: List[NotNullInfo]): Unit = myNotNullInfos = infos + /** Cache for type signature if computed without forcing annotations + * by `typeSigOnly` + */ + private var knownTypeSig: Type = NoType + protected def typeSig(sym: Symbol): Type = original match case original: ValDef => if (sym.is(Module)) moduleValSig(sym) @@ -1006,12 +1011,20 @@ class Namer { typer: Typer => val sym = denot.symbol addAnnotations(sym) addInlineInfo(sym) - denot.info = typeSig(sym) + denot.info = knownTypeSig `orElse` typeSig(sym) invalidateIfClashingSynthetic(denot) normalizeFlags(denot) Checking.checkWellFormed(sym) denot.info = avoidPrivateLeaks(sym) } + + /** Just the type signature without forcing any of the other parts of + * this denotation. The denotation will still be completed later. + */ + def typeSigOnly(sym: Symbol): Type = + if !knownTypeSig.exists then + knownTypeSig = typeSig(sym) + knownTypeSig } class TypeDefCompleter(original: TypeDef)(ictx: Context) @@ -1974,10 +1987,12 @@ class Namer { typer: Typer => for params <- ddef.termParamss; param <- params do val psym = symbolOfTree(param) if needsTracked(psym, param, owningSym) then - psym.setFlag(Tracked) - setParamTrackedWithAccessors(psym, sym.maybeOwner.infoOrCompleter) + println(i"NEEDS TRACKED $psym in $owningSym in ${ctx.source}") + if Feature.enabled(modularity) then + psym.setFlag(Tracked) + setParamTrackedWithAccessors(psym, sym.maybeOwner.infoOrCompleter) - if Feature.enabled(modularity) then addTrackedIfNeeded(ddef, sym.maybeOwner) + if Feature.enabled(modularity) || true then addTrackedIfNeeded(ddef, sym.maybeOwner) if isConstructor then // set result type tree to unit, but take the current class as result type of the symbol @@ -2030,30 +2045,25 @@ class Namer { typer: Typer => psym.setFlag(Tracked) acc.setFlag(Tracked) - /** `psym` needs tracked if it is referenced in any of the public signatures - * of the defining class or when `psym` is a context bound witness with an - * abstract type member + /** `psym` needs an inferred tracked if + * - it is a val parameter of a class or + * an evidence parameter of a context bound witness, and + * - its type contains an abstract type member. */ def needsTracked(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context) = - lazy val needsTrackedSimp = needsTrackedSimple(psym, param, owningSym) + lazy val accessorSyms = maybeParamAccessors(owningSym, psym) + + def infoDontForceAnnots = psym.infoOrCompleter match + case completer: this.Completer => completer.typeSigOnly(psym) + case tpe => tpe + !psym.is(Tracked) && psym.isTerm - && needsTrackedSimp - - private def needsTrackedSimple(psym: Symbol, param: ValDef, owningSym: Symbol)(using Context): Boolean = - val accessorSyms = maybeParamAccessors(owningSym, psym) - (owningSym.isClass || owningSym.isAllOf(Given | Method)) - && !accessorSyms.exists(_.is(Mutable)) + && (owningSym.isClass || owningSym.isAllOf(Given | Method)) + && accessorSyms.forall(!_.is(Mutable)) && (param.hasAttachment(ContextBoundParam) || accessorSyms.exists(!_.isOneOf(PrivateLocal))) - && psym.infoDontForceAnnotsAndInferred(param).memberNames(abstractTypeNameFilter).nonEmpty - - extension (sym: Symbol) - private def infoDontForceAnnotsAndInferred(tree: DefTree)(using Context): Type = - sym.infoOrCompleter match - case tpe if tree.mods.annotations.nonEmpty => tpe - case tpe: LazyType if tpe.isExplicit => sym.info - case tpe if sym.isType => sym.info - case info => info + && infoDontForceAnnots.abstractTypeMembers.nonEmpty + end needsTracked private def maybeParamAccessors(owner: Symbol, sym: Symbol)(using Context): List[Symbol] = owner.infoOrCompleter match case info: ClassInfo => From 19cf3fc54afa86337152f99af4b6ff6352532e57 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 10:14:25 +0800 Subject: [PATCH 07/11] Drop the isExplicit type and hasExplicitType logic --- compiler/src/dotty/tools/dotc/core/SymDenotations.scala | 3 --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 6dcf2a83ba5c..5b7127d1cdf9 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -2799,9 +2799,6 @@ object SymDenotations { /** Sets all missing fields of given denotation */ def complete(denot: SymDenotation)(using Context): Unit - /** Is this a completer for an explicit type tree */ - def isExplicit: Boolean = false - def apply(sym: Symbol): LazyType = this def apply(module: TermSymbol, modcls: ClassSymbol): LazyType = this diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 4e7af9c57d20..92444715e80e 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -280,9 +280,6 @@ class Namer { typer: Typer => if rhs.isEmpty || flags.is(Opaque) then flags |= Deferred if flags.is(Param) then tree.rhs else analyzeRHS(tree.rhs) - def hasExplicitType(tree: ValOrDefDef): Boolean = - !tree.tpt.isEmpty || tree.mods.isOneOf(TermParamOrAccessor) - // to complete a constructor, move one context further out -- this // is the context enclosing the class. Note that the context in which a // constructor is recorded and the context in which it is completed are @@ -296,8 +293,6 @@ class Namer { typer: Typer => val completer = tree match case tree: TypeDef => TypeDefCompleter(tree)(cctx) - case tree: ValOrDefDef if Feature.enabled(Feature.modularity) && hasExplicitType(tree) => - new Completer(tree, isExplicit = true)(cctx) case _ => Completer(tree)(cctx) val info = adjustIfModule(completer, tree) createOrRefine[Symbol](tree, name, flags, ctx.owner, _ => info, @@ -813,7 +808,7 @@ class Namer { typer: Typer => } /** The completer of a symbol defined by a member def or import (except ClassSymbols) */ - class Completer(val original: Tree, override val isExplicit: Boolean = false)(ictx: Context) extends LazyType with SymbolLoaders.SecondCompleter { + class Completer(val original: Tree)(ictx: Context) extends LazyType with SymbolLoaders.SecondCompleter { protected def localContext(owner: Symbol): FreshContext = ctx.fresh.setOwner(owner).setTree(original) From 84c7e66b6d0dfb4de8a6df4ea1d4eac8922dd9f8 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 10:18:37 +0800 Subject: [PATCH 08/11] Drop the "needs tracked" diagnostic --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 92444715e80e..67b26c7a7507 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1982,12 +1982,11 @@ class Namer { typer: Typer => for params <- ddef.termParamss; param <- params do val psym = symbolOfTree(param) if needsTracked(psym, param, owningSym) then - println(i"NEEDS TRACKED $psym in $owningSym in ${ctx.source}") if Feature.enabled(modularity) then psym.setFlag(Tracked) setParamTrackedWithAccessors(psym, sym.maybeOwner.infoOrCompleter) - if Feature.enabled(modularity) || true then addTrackedIfNeeded(ddef, sym.maybeOwner) + if Feature.enabled(modularity) then addTrackedIfNeeded(ddef, sym.maybeOwner) if isConstructor then // set result type tree to unit, but take the current class as result type of the symbol From a1bb91f2fc8e0a7de30be76b2889774a7bc6badf Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 10:21:55 +0800 Subject: [PATCH 09/11] Break out code for testing tracked inference Break out code for testing tracked inference independently of x.modularity --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 67b26c7a7507..8e776ba214c5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1933,6 +1933,10 @@ class Namer { typer: Typer => else mbrTpe } + // Decides whether we want to run tracked inference on all code, not just + // code with x.modularity + private inline val testTrackedInference = true + /** The type signature of a DefDef with given symbol */ def defDefSig(ddef: DefDef, sym: Symbol, completer: Namer#Completer)(using Context): Type = // Beware: ddef.name need not match sym.name if sym was freshened! @@ -1981,12 +1985,12 @@ class Namer { typer: Typer => def addTrackedIfNeeded(ddef: DefDef, owningSym: Symbol): Unit = for params <- ddef.termParamss; param <- params do val psym = symbolOfTree(param) - if needsTracked(psym, param, owningSym) then - if Feature.enabled(modularity) then - psym.setFlag(Tracked) - setParamTrackedWithAccessors(psym, sym.maybeOwner.infoOrCompleter) + if needsTracked(psym, param, owningSym) && Feature.enabled(modularity) then + psym.setFlag(Tracked) + setParamTrackedWithAccessors(psym, sym.maybeOwner.infoOrCompleter) - if Feature.enabled(modularity) then addTrackedIfNeeded(ddef, sym.maybeOwner) + if Feature.enabled(modularity) || testTrackedInference then + addTrackedIfNeeded(ddef, sym.maybeOwner) if isConstructor then // set result type tree to unit, but take the current class as result type of the symbol From 7b2a785402419386b3ebca9d99d886bd5d38014d Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 14:49:21 +0800 Subject: [PATCH 10/11] Turn `testTrackedInference` off Check parameters whether they need to be tracked only under x.modularity. --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 8e776ba214c5..02a55be9ea5a 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1935,7 +1935,7 @@ class Namer { typer: Typer => // Decides whether we want to run tracked inference on all code, not just // code with x.modularity - private inline val testTrackedInference = true + private inline val testTrackedInference = false /** The type signature of a DefDef with given symbol */ def defDefSig(ddef: DefDef, sym: Symbol, completer: Namer#Completer)(using Context): Type = From 069dd61a7d406c9f94cf517b4adf93928dd35642 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Oct 2025 16:13:22 +0800 Subject: [PATCH 11/11] Update doc page --- .../reference/experimental/modularity.md | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/docs/_docs/reference/experimental/modularity.md b/docs/_docs/reference/experimental/modularity.md index 580044ce4d66..82481dfefad1 100644 --- a/docs/_docs/reference/experimental/modularity.md +++ b/docs/_docs/reference/experimental/modularity.md @@ -116,25 +116,22 @@ ClsParam ::= {Annotation} [{Modifier | ‘tracked’} (‘val’ | ‘var’)] The (soft) `tracked` modifier is only allowed for `val` parameters of classes. -### Tracked inference +### Tracked Inference -In some cases `tracked` can be infered and doesn't have to be written -explicitly. A common such case is when a class parameter is referenced in the -signatures of the public members of the class. e.g. -```scala 3 -class OrdSet(val ord: Ordering) { - type Set = List[ord.T] - def empty: Set = Nil +In some common cases the tracked modifier can be inferred, so it does not +need to be written explicitly. Specifically, we infer `tracked` for a `val` +parameter of a class if the formal parameter's type defines an abstract type member. +This means that we do not lose information about how that member +is defined in the actual argument passed to the class constructor. - implicit class helper(s: Set) { - def add(x: ord.T): Set = x :: remove(x) - def remove(x: ord.T): Set = s.filter(e => ord.compare(x, e) != 0) - def member(x: ord.T): Boolean = s.exists(e => ord.compare(x, e) == 0) - } -} +For instance, tracked `would` be inferred for the `SetFunctor` class +we defined before, so we can also write it like this: +```scala +class SetFunctor(val ord: Ordering): + type Set = List[ord.T] + ... ``` -In the example above, `ord` is referenced in the signatures of the public -members of `OrdSet`, so a `tracked` modifier will be inserted automatically. +The `tracked` modifier on the `ord` parameter is inferred here, since `ord` is of type `Ordering`, which defines an abstract type member `T`. Another common case is when a context bound has an associated type (i.e. an abstract type member) e.g. ```scala 3 @@ -145,7 +142,7 @@ trait TC: class Klass[A: {TC as tc}] ``` -Here, `tc` is a context bound with an associated type `T`, so `tracked` will be inferred for `tc`. +Here, `tc` is a context bound with an associated type `T`, so `tracked val` will be inferred for `tc` and the parameter will be represented as a field. ### Discussion @@ -160,10 +157,10 @@ If we assume `tracked` for parameter `x` (which is implicitly a `val`), then `foo` would get inferred type `Foo { val x: 1 }`, so it could not be reassigned to a value of type `Foo { val x: 2 }` on the next line. -Another approach might be to assume `tracked` for a `val` parameter `x` -only if the class refers to a type member of `x`. But it turns out that this -scheme is unimplementable since it would quickly lead to cyclic references -when typechecking recursive class graphs. So an explicit `tracked` looks like the best available option. +Another concern is that using tracked for all `val` parameters, including +parameters of case classes could lead to large refinement types. + +Therefore, inferring tracked only for parameters with types that define abstract members is a usable compromise. After all, if we did not infer `tracked` for these types, any references to the abstract type via a path would likely produce compilation errors. ## Tracked members