File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -213,10 +213,14 @@ object NameKinds {
213
213
safePrefix + info.num
214
214
}
215
215
216
- /** Generate fresh unique name of this kind with given prefix name */
216
+ /** Generate fresh unique term name of this kind with given prefix name */
217
217
def fresh (prefix : TermName = EmptyTermName )(implicit ctx : Context ): TermName =
218
218
ctx.freshNames.newName(prefix, this )
219
219
220
+ /** Generate fresh unique type name of this kind with given prefix name */
221
+ def fresh (prefix : TypeName )(implicit ctx : Context ): TypeName =
222
+ fresh(prefix.toTermName).toTypeName
223
+
220
224
uniqueNameKinds(separator) = this
221
225
}
222
226
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import Trees._
9
9
import Constants ._
10
10
import Scopes ._
11
11
import ProtoTypes ._
12
- import NameKinds .WildcardParamName
12
+ import NameKinds .UniqueName
13
13
import annotation .unchecked
14
14
import util .Positions ._
15
15
import util .{Stats , SimpleIdentityMap }
@@ -242,7 +242,7 @@ object Inferencing {
242
242
if (bounds.hi <:< bounds.lo || bounds.hi.classSymbol.is(Final ) || fromScala2x)
243
243
tvar.instantiate(fromBelow = false )
244
244
else {
245
- val wildCard = ctx.newPatternBoundSymbol(WildcardParamName .fresh().toTypeName , bounds, pos)
245
+ val wildCard = ctx.newPatternBoundSymbol(UniqueName .fresh(tvar.origin.paramName) , bounds, pos)
246
246
tvar.instantiateWith(wildCard.typeRef)
247
247
patternBound += wildCard
248
248
}
Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ object Test {
11
11
// -- [E007] Type Mismatch Error: tests/neg/gadt-eval.scala:10:6 ------------------
12
12
// 10 | (eval(a), eval(a))
13
13
// | ^^^^^^^^^^^^^^^^^^
14
- // | found: (_ $1, _ $1)
14
+ // | found: (A $1, A $1)
15
15
// | required: T
16
16
// |
17
- // | where: T is a type in method eval which is an alias of (_ $1, _$2 )
17
+ // | where: T is a type in method eval which is an alias of (A $1, B$1 )
18
18
}
19
19
20
20
def eval2 [T ](e : Exp [T ]): T = e match {
You can’t perform that action at this time.
0 commit comments