aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-18 19:29:02 +0100
committerFelix Mulder <felix.mulder@gmail.com>2016-12-20 18:33:44 +0100
commit7c5e36b80e111d17910dbf122c02a458377656d1 (patch)
tree210ba0cde3e81925aab1af83ab1353c6606a1331 /compiler/src/dotty/tools/dotc/core/Types.scala
parent9c0df5aa3af3906913f6507e04078c32dd2a4742 (diff)
downloaddotty-7c5e36b80e111d17910dbf122c02a458377656d1.tar.gz
dotty-7c5e36b80e111d17910dbf122c02a458377656d1.tar.bz2
dotty-7c5e36b80e111d17910dbf122c02a458377656d1.zip
More lenient handling of mixed parameterless and nullary methods
When faced with a denotation that combines parameterless and nullary method definitions (toString is a common example), ignore any redundant () applications.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index 069b4f60d..df1e68944 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -217,6 +217,14 @@ object Types {
case _ => false
}
+ /** Is this the type of a method with a leading empty parameter list?
+ */
+ def isNullaryMethod(implicit ctx: Context): Boolean = this match {
+ case MethodType(Nil, _) => true
+ case tp: PolyType => tp.resultType.isNullaryMethod
+ case _ => false
+ }
+
/** Is this an alias TypeBounds? */
def isAlias: Boolean = this.isInstanceOf[TypeAlias]