diff options
author | liu fengyun <liu@fengy.me> | 2016-10-14 17:25:49 +0200 |
---|---|---|
committer | liu fengyun <liu@fengy.me> | 2016-10-14 17:46:58 +0200 |
commit | eca3f6997e324559aa499cced51a275fe118051f (patch) | |
tree | bb15b1c5f4b180a43e3857ff970912bc57210ad3 | |
parent | cbe2ab26d3b507a33f1b910a803878d78f751f74 (diff) | |
download | dotty-eca3f6997e324559aa499cced51a275fe118051f.tar.gz dotty-eca3f6997e324559aa499cced51a275fe118051f.tar.bz2 dotty-eca3f6997e324559aa499cced51a275fe118051f.zip |
add another test for i1540
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 2 | ||||
-rw-r--r-- | tests/pos/i1540b.scala | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 9e6c6412a..8636d5084 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -240,7 +240,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer { val isDefined = extractorMemberType(prev.tpe, nme.isDefined) if ((isDefined isRef defn.BooleanClass) && getTp.exists) { - // isDefined and get maybe overloaded + // isDefined and get may be overloaded val getDenot = prev.tpe.member(nme.get).suchThat(_.info.isParameterless) val isDefinedDenot = prev.tpe.member(nme.isDefined).suchThat(_.info.isParameterless) diff --git a/tests/pos/i1540b.scala b/tests/pos/i1540b.scala new file mode 100644 index 000000000..2b4c5408e --- /dev/null +++ b/tests/pos/i1540b.scala @@ -0,0 +1,14 @@ +class Casey1[T](val a: T) { + def isDefined: Boolean = true + def isDefined(x: T): Boolean = ??? + def get: T = a + def get(x: T): String = ??? +} +object Casey1 { def unapply[T](a: Casey1[T]) = a } + +object Test { + def main(args: Array[String]): Unit = { + val c @ Casey1(x) = new Casey1(0) + assert(x == c.get) + } +} |