diff options
author | Martin Odersky <odersky@gmail.com> | 2014-06-12 16:57:24 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-06-12 16:57:24 +0200 |
commit | c1b884bbf80bc4c906ada08904d83510f2322ae7 (patch) | |
tree | 6551152bcee0ee4c3d149b6595093f9e6286b015 /src/dotty | |
parent | c2bcf2ec054b3c20b9addd9d1dd6de286de7f6c3 (diff) | |
download | dotty-c1b884bbf80bc4c906ada08904d83510f2322ae7.tar.gz dotty-c1b884bbf80bc4c906ada08904d83510f2322ae7.tar.bz2 dotty-c1b884bbf80bc4c906ada08904d83510f2322ae7.zip |
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.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 3f567d87a..08588818f 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -33,8 +33,11 @@ class Definitions { private def newTopClassSymbol(name: TypeName, flags: FlagSet, parents: List[TypeRef]) = completeClass(newCompleteClassSymbol(ScalaPackageClass, name, flags, parents)) + private def newTypeField(cls: ClassSymbol, name: TypeName, flags: FlagSet, scope: MutableScope) = + scope.enter(newSymbol(cls, name, flags, TypeBounds.empty)) + private def newTypeParam(cls: ClassSymbol, name: TypeName, flags: FlagSet, scope: MutableScope) = - scope.enter(newSymbol(cls, name, flags | TypeParamCreationFlags, TypeBounds.empty)) + newTypeField(cls, name, flags | TypeParamCreationFlags, scope) private def newSyntheticTypeParam(cls: ClassSymbol, scope: MutableScope, paramFlags: FlagSet, suffix: String = "T0") = newTypeParam(cls, suffix.toTypeName.expandedName(cls), ExpandedName | paramFlags, scope) @@ -512,7 +515,7 @@ class Definitions { val paramDecls = newScope for (i <- 0 until vcs.length) newTypeParam(cls, tpnme.lambdaArgName(i), varianceFlags(vcs(i)), paramDecls) - newTypeParam(cls, tpnme.Apply, EmptyFlags, paramDecls) + newTypeField(cls, tpnme.Apply, EmptyFlags, paramDecls) val parentTraitRefs = for (i <- 0 until vcs.length if vcs(i) != 0) yield lambdaTrait(vcs.updated(i, 0)).typeRef |