diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-12 18:01:27 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-13 16:04:53 +0200 |
commit | d4dc78c3ebe4e8b559c3a85b6b77c321b239bb90 (patch) | |
tree | 55757545f3880fb74fb09a082fd2df32fa0133fa /src/dotty/tools/dotc/core/TypeApplications.scala | |
parent | dcfebd88e42afb18d176748fb89f78199f57f8d4 (diff) | |
download | dotty-d4dc78c3ebe4e8b559c3a85b6b77c321b239bb90.tar.gz dotty-d4dc78c3ebe4e8b559c3a85b6b77c321b239bb90.tar.bz2 dotty-d4dc78c3ebe4e8b559c3a85b6b77c321b239bb90.zip |
New method on types: givenSelfType
The self type as given (or implied for module classes) in the source.
Also defined and updated for normal types, not just ClassInfo types.
Common functionality between this and baseTypeWithArgs has been pulled
into RefinedType#wrapIfMember.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index df18813b9..de42b3e5f 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -268,9 +268,7 @@ class TypeApplications(val self: Type) extends AnyVal { case _ => default } case tp @ RefinedType(parent, name) if !tp.member(name).symbol.is(ExpandedTypeParam) => - val pbase = parent.baseTypeWithArgs(base) - if (pbase.member(name).exists) RefinedType(pbase, name, tp.refinedInfo) - else pbase + tp.wrapIfMember(parent.baseTypeWithArgs(base)) case tp: TermRef => tp.underlying.baseTypeWithArgs(base) case AndType(tp1, tp2) => @@ -281,7 +279,7 @@ class TypeApplications(val self: Type) extends AnyVal { default } } - + /** Translate a type of the form From[T] to To[T], keep other types as they are. * `from` and `to` must be static classes, both with one type parameter, and the same variance. */ |