File tree Expand file tree Collapse file tree 5 files changed +31
-22
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 5 files changed +31
-22
lines changed Original file line number Diff line number Diff line change @@ -726,11 +726,14 @@ trait Applications extends Compatibility {
726726 def addTyped (arg : Arg ): List [Type ] =
727727 if ! formal.isRepeatedParam then checkNoVarArg(arg)
728728 addArg(typedArg(arg, formal), formal)
729- if methodType.isParamDependent && typeOfArg(arg).exists then
730- // `typeOfArg(arg)` could be missing because the evaluation of `arg` produced type errors
731- formals1.mapconserve(safeSubstParam(_, methodType.paramRefs(n), typeOfArg(arg)))
732- else
733- formals1
729+ if methodType.looksParamDependent
730+ // need to handle also false dependencies since we generate TypeTrees from
731+ // formal parameters in makeVarArg. These are not de-aliased, so they might contain
732+ // stray parameter references. Test case is i23266.scala.
733+ && typeOfArg(arg).exists
734+ // `typeOfArg(arg)` could be missing because the evaluation of `arg` produced type errors
735+ then formals1.mapconserve(safeSubstParam(_, methodType.paramRefs(n), typeOfArg(arg)))
736+ else formals1
734737
735738 def missingArg (n : Int ): Unit =
736739 fail(MissingArgument (methodType.paramNames(n), methString))
Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ parsercombinators-new-syntax.scala
139139hylolib-deferred-given
140140hylolib-cb
141141hylolib
142+ i23266.scala
142143
143144# typecheckErrors method unpickling
144145i21415.scala
Original file line number Diff line number Diff line change 1- -- [E007] Type Mismatch Error: tests/neg/i16842.scala:24:8 -------------------------------------------------------------
2- 24 | Liter(SemanticArray[SemanticInt.type], x) // error // error
3- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4- | Found: Int => SemanticArray[SemanticInt.type]
5- | Required: SemanticArray[SemanticType]
6- |
7- | longer explanation available when compiling with `-explain`
8- -- [E007] Type Mismatch Error: tests/neg/i16842.scala:24:41 ------------------------------------------------------------
9- 24 | Liter(SemanticArray[SemanticInt.type], x) // error // error
10- | ^
11- | Found: (x : List[Expr2[SemanticInt.type]])
12- | Required: ty.T
13- | Note that implicit conversions were not tried because the result of an implicit conversion
14- | must be more specific than ty.T
15- |
16- | longer explanation available when compiling with `-explain`
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+
2+ def kek (t : Table , ids : t.Id * ) = ???
3+
4+ trait Table {
5+ type Id = String
6+ }
7+
8+ object Table1 extends Table {
9+ val id : Id = " table1_id"
10+ }
11+
12+ class Table2 () extends Table {
13+ val id : Id = " table2_id"
14+ }
15+
16+ val x = kek(Table1 , Table1 .id)
17+ val y = kek(Table2 (), Table2 ().id)
You can’t perform that action at this time.
0 commit comments