diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-25 11:31:46 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-25 11:34:04 +0100 |
commit | 45ea511ec8ef12e0a192e4f4925923e75ef9ae3a (patch) | |
tree | f498f664b8a2b7133c86bc37c481aafccfef99b3 /src/dotty/tools/dotc/core/Types.overflow | |
parent | 92ed954f361ed08ef4821afd530357379956904a (diff) | |
download | dotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.tar.gz dotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.tar.bz2 dotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.zip |
Types refactorings
- moving out type applicaton related operations to a decorator: TypeApplications
- converting some set operations to list operations to make them replayable.
- moving unused operations to Types.overflow
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.overflow')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.overflow | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.overflow b/src/dotty/tools/dotc/core/Types.overflow new file mode 100644 index 000000000..45727fcc1 --- /dev/null +++ b/src/dotty/tools/dotc/core/Types.overflow @@ -0,0 +1,25 @@ +object Types { + class Type { + + /** The non-private symbol with given name in the given class that matches this type. + * @param inClass The class containing the symbol's definition + * @param name The name of the symbol we are looking for + * @param site The base type from which member types are computed + def matchingTermSymbol(inClass: Symbol, name: Name, site: Type)(implicit ctx: Context): Symbol = { + var denot = inClass.info.nonPrivateDecl(name) + if (denot.isTerm) { // types of the same name always match + if (denot.isOverloaded) + denot = denot.atSignature(this.signature) // seems we need two kinds of signatures here + if (!(site.memberInfo(denot.symbol) matches this)) + denot = NoDenotation + } + denot.symbol + } + + final def firstParamTypes: List[Type] = this match { + case mt: MethodType => mt.paramTypes + case pt: PolyType => pt.firstParamTypes + case _ => Nil + } + } +}
\ No newline at end of file |