From 42ee73f47e17f6e1c028444d3b144c9a9c8cf561 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 25 Nov 2013 15:11:40 +0100 Subject: More Types polishings In paricular, now type accumulators include the prefix of a ClassInfo type. --- src/dotty/tools/dotc/core/Types.overflow | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (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 index 0474bc229..77f1f6fc1 100644 --- a/src/dotty/tools/dotc/core/Types.overflow +++ b/src/dotty/tools/dotc/core/Types.overflow @@ -32,4 +32,35 @@ object Types { } + + class AndType extends Type { + + def derived_& (tp1: Type, tp2: Type)(implicit ctx: Context) = + if ((tp1 eq this.tp1) && (tp2 eq this.tp2)) this + else tp1 & tp2 + + } + + class OrType extends Type { + + def derived_| (tp1: Type, tp2: Type)(implicit ctx: Context) = + if ((tp1 eq this.tp1) && (tp2 eq this.tp2)) this + else tp1 | tp2 + + } + + class MethodType { + /* probably won't be needed + private var _isVarArgs: Boolean = _ + private var knownVarArgs: Boolean = false + + def isVarArgs(implicit ctx: Context) = { + if (!knownVarArgs) { + _isVarArgs = paramTypes.nonEmpty && paramTypes.last.isRepeatedParam + knownVarArgs = true + } + _isVarArgs + } + */ + } } \ No newline at end of file -- cgit v1.2.3