From 45ea511ec8ef12e0a192e4f4925923e75ef9ae3a Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 25 Nov 2013 11:31:46 +0100 Subject: 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 --- src/dotty/tools/dotc/core/Types.overflow | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/dotty/tools/dotc/core/Types.overflow (limited to 'src/dotty/tools/dotc/core/Types.overflow') 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 -- cgit v1.2.3