कोड टिप्पणी की है, तो चलो कि स्वाद के लिए एक क्षण ले जाने:
/** If we can absolutely rule out a match we can fail early.
* This is the case if the scrutinee has no unresolved type arguments
* and is a "final type", meaning final + invariant in all type parameters.
*/
सूचना है कि कोई नहीं, अंतिम नहीं है, उदाहरण के लिए। मुझे सही पता है?
क्या तुमने कभी scalac -Ypatmat-डिबग कोशिश करते हैं, टिप्पणी यहाँ मदद कर सकता है:
https://github.com/scala/scala/pull/650
गम्यता लगभग पहुंच के भीतर है:
https://issues.scala-lang.org/browse/SI-6146
लेकिन मैं नहीं दिख रहा है किसी दिन के बारे में कोई वादा किया जा सकता है कि क्या चेतावनी दी जा सकती है। प्रदर्शन कारणों से? कोई यह भी कह सकता है, इसे किसी उदाहरण के बारे में चेतावनी क्यों दी जानी चाहिए [फू [_]]?
अभी के लिए, spec सेक्शन 8.2 - 8.4 प्रेरित करते हैं कि क्यों फू [ए] के खिलाफ मिलान दिलचस्प है (सीमाएं प्राप्त करने के कारण)। मुझे लगता है कि मैं फिर से पढ़ूंगा। कुछ कॉफी के बाद।
trait Foo[+A]
final class Fuzz[+A] extends Foo[A]
final object Fooz extends Foo[Nothing]
object Futz extends Foo[Nothing]
//error
Fooz match {
case x: List[_] => println("A")
case _ => println("B")
}
//no error
Futz match { ... }
स्रोत
2012-09-10 06:41:33
एक बग की तरह दिखता है। मैं इसकी रिपोर्ट करूंगा। – sschaef