aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-01-27 17:38:18 +0100
committerMartin Odersky <odersky@gmail.com>2015-02-07 17:32:47 +0100
commit945576e421e5f7dc82984c4673884ad4c7ddf969 (patch)
treea5c12d64eff7c46dbb21247ce2cbba1ec5f23200 /src/dotty/tools/dotc/core/Types.scala
parent43ee240c3db3820cecb23ab22c93b1df2412cdc8 (diff)
downloaddotty-945576e421e5f7dc82984c4673884ad4c7ddf969.tar.gz
dotty-945576e421e5f7dc82984c4673884ad4c7ddf969.tar.bz2
dotty-945576e421e5f7dc82984c4673884ad4c7ddf969.zip
New spec and implementation for matching.
Reformulated matchign spec and implemented accordingly. Previous fix for #329 would have missed third new error case in over.scala.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 6c87d44e6..e759c3ad3 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -598,17 +598,21 @@ object Types {
* - Either both types are polytypes with the same number of
* type parameters and their result types match after renaming
* corresponding type parameters
- * - Or both types are (possibly nullary) method types with equivalent parameter types
- * and matching result types
- * - Or both types are equivalent
- * - Or phase.erasedTypes is false and both types are neither method nor
- * poly types.
+ * - Or both types are method types with =:=-equivalent(*) parameter types
+ * and matching result types after renaming corresponding parameter types
+ * if the method types are dependent.
+ * - Or both types are =:=-equivalent
+ * - Or phase.erasedTypes is false, and neither type takes
+ * term or type parameters.
+ *
+ * (*) when matching with a Java method, we also regard Any and Object as equivalent
+ * parameter types.
*/
def matches(that: Type)(implicit ctx: Context): Boolean =
if (Config.newMatch) this.signature matches that.signature
else track("matches") {
ctx.typeComparer.matchesType(
- this, that, alwaysMatchSimple = !ctx.phase.erasedTypes)
+ this, that, relaxed = !ctx.phase.erasedTypes)
}
/** This is the same as `matches` except that it also matches => T with T and