diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-21 10:28:56 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-21 10:29:09 +0100 |
commit | 5dae5f2953438e8a1443075b44b310965c2cf863 (patch) | |
tree | 133a7fe8afed600767ad6b1cba4151ff87ea0e23 /compiler/src/dotty/tools/dotc/core/TypeComparer.scala | |
parent | f467be62da8978e506f58b702b84e74ef7ce09de (diff) | |
download | dotty-5dae5f2953438e8a1443075b44b310965c2cf863.tar.gz dotty-5dae5f2953438e8a1443075b44b310965c2cf863.tar.bz2 dotty-5dae5f2953438e8a1443075b44b310965c2cf863.zip |
Fix #2000: Make implicit and non-implicit functions incomparable with <:<
Implicit and non-implicit functions are incomparable with <:<, but are
treated as equivalent with `matches`. This means implicit and non-implicit
functions of the same types override each other, but RefChecks will
give an error because their types are not subtypes.
Also contains a test for #2002.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TypeComparer.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 6063cbf38..fca111702 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -489,7 +489,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { case tp1 @ MethodType(_, formals1) => (tp1.signature consistentParams tp2.signature) && matchingParams(formals1, formals2, tp1.isJava, tp2.isJava) && - (!tp1.isImplicit || tp2.isImplicit) && // non-implicit functions shadow implicit ones + (tp1.isImplicit == tp2.isImplicit) && isSubType(tp1.resultType, tp2.resultType.subst(tp2, tp1)) case _ => false |