diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-15 11:13:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-06 13:15:27 +0200 |
commit | 549bd812684e6f269610234ddefe8054dfb42746 (patch) | |
tree | bd757cc74c22a3c20c21b8b4abda97b56045e589 /compiler/src | |
parent | bf2f77e112bbc1d242a4f91b113ba3cc14c3dcc8 (diff) | |
download | dotty-549bd812684e6f269610234ddefe8054dfb42746.tar.gz dotty-549bd812684e6f269610234ddefe8054dfb42746.tar.bz2 dotty-549bd812684e6f269610234ddefe8054dfb42746.zip |
Drop name checking scheme for type parameters
It was a red herring. Symbolic names are expanded anyway to $plus / $minus,
so they can't be confused with a variance prefix.
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 1531e67b3..10b522eaa 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -242,20 +242,14 @@ object desugar { * class C { type v C$T; type v T = C$T } */ def typeDef(tdef: TypeDef)(implicit ctx: Context): Tree = { - val checkedName = - if (tdef.name.hasVariance && tdef.mods.is(Param)) { - ctx.error(em"type parameter name may not start with `+' or `-'", tdef.pos) - ("$" + tdef.name).toTypeName - } - else tdef.name if (tdef.mods is PrivateLocalParam) { - val tparam = cpy.TypeDef(tdef)(name = checkedName.expandedName(ctx.owner)) + val tparam = cpy.TypeDef(tdef)(name = tdef.name.expandedName(ctx.owner)) .withMods(tdef.mods &~ PrivateLocal | ExpandedName) - val alias = cpy.TypeDef(tdef)(name = checkedName, rhs = refOfDef(tparam)) + val alias = cpy.TypeDef(tdef)(name = tdef.name, rhs = refOfDef(tparam)) .withMods(tdef.mods & VarianceFlags | PrivateLocalParamAccessor | Synthetic) Thicket(tparam, alias) } - else cpy.TypeDef(tdef)(name = checkedName) + else tdef } @sharable private val synthetic = Modifiers(Synthetic) |