diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-11 22:20:24 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-11-11 22:20:24 +0100 |
commit | 97b6985c34915b58e0c81fbab464f4bd532c27d0 (patch) | |
tree | 968795a36f2eb50791166f8288a8d5ad1f72c285 /src/dotty/tools/dotc/parsing/JavaParsers.scala | |
parent | f3c8fdddcc7a5aef1c206afb0942d4a961ef1186 (diff) | |
download | dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.tar.gz dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.tar.bz2 dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.zip |
Clean up parameterized typedefs
Express them in terms PolyTypeTrees rather than having an
irregular, untyped only tparams field. This is necessary
if we want to pickle type trees instead of types, because
now the rhs of a typedef tells the whole story, so we are not
required any longer to use the info of the symbol.
Diffstat (limited to 'src/dotty/tools/dotc/parsing/JavaParsers.scala')
-rw-r--r-- | src/dotty/tools/dotc/parsing/JavaParsers.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/parsing/JavaParsers.scala b/src/dotty/tools/dotc/parsing/JavaParsers.scala index b6a423dc7..0f63b25bb 100644 --- a/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -417,7 +417,7 @@ object JavaParsers { atPos(in.offset) { val name = identForType() val hi = if (in.token == EXTENDS) { in.nextToken() ; bound() } else EmptyTree - TypeDef(name, Nil, TypeBoundsTree(EmptyTree, hi)).withMods(Modifiers(flags)) + TypeDef(name, TypeBoundsTree(EmptyTree, hi)).withMods(Modifiers(flags)) } def bound(): Tree = @@ -625,8 +625,7 @@ object JavaParsers { val template = cdef.rhs.asInstanceOf[Template] cpy.TypeDef(cdef)(cdef.name, cpy.Template(template)(template.constr, template.parents, template.self, - importCompanionObject(cdef) :: template.body), - cdef.tparams).withMods(cdef.mods) + importCompanionObject(cdef) :: template.body)).withMods(cdef.mods) } List(makeCompanionObject(cdefNew, statics), cdefNew) @@ -715,7 +714,7 @@ object JavaParsers { val (statics, body) = typeBody(INTERFACE, name, tparams) val iface = atPos(start, nameOffset) { TypeDef( - name, tparams, + name, makeTemplate(parents, body, tparams, false)).withMods(mods | Flags.Trait | Flags.JavaInterface | Flags.Abstract) } addCompanionObject(statics, iface) @@ -830,7 +829,7 @@ object JavaParsers { Select(New(javaLangDot(tpnme.Enum)), nme.CONSTRUCTOR), List(enumType)), List(Literal(Constant(null)),Literal(Constant(0)))) val enum = atPos(start, nameOffset) { - TypeDef(name, List(), + TypeDef(name, makeTemplate(superclazz :: interfaces, body, List(), true)).withMods(mods | Flags.Enum) } addCompanionObject(consts ::: statics ::: predefs, enum) |