Skip to content

Commit c1b884b

Browse files
committed
Make Lambda#Apply a type field instead of a type parameter.
Apply cannot be treated as a type parameter because it does not count towards the number of legal arguments in an instantiation of a higher-kinded type.
1 parent c2bcf2e commit c1b884b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ class Definitions {
3333
private def newTopClassSymbol(name: TypeName, flags: FlagSet, parents: List[TypeRef]) =
3434
completeClass(newCompleteClassSymbol(ScalaPackageClass, name, flags, parents))
3535

36+
private def newTypeField(cls: ClassSymbol, name: TypeName, flags: FlagSet, scope: MutableScope) =
37+
scope.enter(newSymbol(cls, name, flags, TypeBounds.empty))
38+
3639
private def newTypeParam(cls: ClassSymbol, name: TypeName, flags: FlagSet, scope: MutableScope) =
37-
scope.enter(newSymbol(cls, name, flags | TypeParamCreationFlags, TypeBounds.empty))
40+
newTypeField(cls, name, flags | TypeParamCreationFlags, scope)
3841

3942
private def newSyntheticTypeParam(cls: ClassSymbol, scope: MutableScope, paramFlags: FlagSet, suffix: String = "T0") =
4043
newTypeParam(cls, suffix.toTypeName.expandedName(cls), ExpandedName | paramFlags, scope)
@@ -512,7 +515,7 @@ class Definitions {
512515
val paramDecls = newScope
513516
for (i <- 0 until vcs.length)
514517
newTypeParam(cls, tpnme.lambdaArgName(i), varianceFlags(vcs(i)), paramDecls)
515-
newTypeParam(cls, tpnme.Apply, EmptyFlags, paramDecls)
518+
newTypeField(cls, tpnme.Apply, EmptyFlags, paramDecls)
516519
val parentTraitRefs =
517520
for (i <- 0 until vcs.length if vcs(i) != 0)
518521
yield lambdaTrait(vcs.updated(i, 0)).typeRef

0 commit comments

Comments
 (0)