File tree Expand file tree Collapse file tree 7 files changed +23
-4
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 7 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -2762,7 +2762,8 @@ object Types {
27622762 NamedType (prefix, name, d)
27632763 }
27642764 if (prefix eq this .prefix) this
2765- else if ! NamedType .validPrefix(prefix) then UnspecifiedErrorType
2765+ else if ! NamedType .validPrefix(prefix) then
2766+ throw TypeError (em " invalid new prefix $prefix cannot replace ${this .prefix} in type $this" )
27662767 else if (lastDenotation == null ) NamedType (prefix, designator)
27672768 else designator match {
27682769 case sym : Symbol =>
@@ -5411,6 +5412,9 @@ object Types {
54115412 def explanation (using Context ): String = msg.message
54125413 }
54135414
5415+ /** Note: Make sure an errors is reported before construtcing this
5416+ * as the type of a tree.
5417+ */
54145418 object ErrorType :
54155419 def apply (m : Message )(using Context ): ErrorType =
54165420 val et = new PreviousErrorType
Original file line number Diff line number Diff line change @@ -699,6 +699,9 @@ class TreePickler(pickler: TastyPickler) {
699699 case ex : AssertionError =>
700700 println(i " error when pickling tree $tree" )
701701 throw ex
702+ case ex : MatchError =>
703+ println(i " error when pickling tree $tree" )
704+ throw ex
702705 }
703706 }
704707
Original file line number Diff line number Diff line change 11object Main {
22 def mkArray [T <: A ]: T # AType // error // error
3- mkArray[Array ] // was: "assertion failed: invalid prefix HKTypeLambda..."
4- val x = mkArray[Array ]
3+ mkArray[Array ] // was: "assertion failed: invalid prefix HKTypeLambda..." // error
4+ val x = mkArray[Array ] // error
55}
Original file line number Diff line number Diff line change 1+ -- Error: tests/neg/i16842.scala:24:7 ----------------------------------------------------------------------------------
2+ 24 | Liter(SemanticArray[SemanticInt.type], x) // error
3+ | ^
4+ | invalid new prefix (dim: Int): SemanticArray[SemanticInt.type] cannot replace ty.type in type ty.T
Original file line number Diff line number Diff line change @@ -21,5 +21,5 @@ def typecheckArrayLiter(
2121 a : ArrayLiter
2222): Liter [SemanticArray [SemanticType ]] = {
2323 val x : List [Expr2 [SemanticInt .type ]] = List ()
24- Liter (SemanticArray [SemanticInt .type ], x) // error // error
24+ Liter (SemanticArray [SemanticInt .type ], x) // error
2525}
Original file line number Diff line number Diff line change 1+ -- Error: tests/neg/i18058.scala:4:21 ----------------------------------------------------------------------------------
2+ 4 |type G = (f: _ <: F) => f.A // error
3+ | ^
4+ | invalid new prefix <: F cannot replace f.type in type f.A
Original file line number Diff line number Diff line change 1+ trait F :
2+ type A
3+
4+ type G = (f : _ <: F ) => f.A // error
You can’t perform that action at this time.
0 commit comments