9
는
경고 : 나는 #scala에서 교차 게시하도록하겠습니다관계는
스칼라의 책 프로그래밍 경로에 의존하는 유형이 해당 경로의 정확한 예에 따라 다르다는 것을 주장 . 그렇다면, 다음의 모든 조건이 true를 돌려 왜 이해가 안 :
class Outer {
val in = new Inner
class Inner
}
val o1 = new Outer
val o2 = new Outer
o1.in.isInstanceOf[Outer#Inner] //makes perfect sense
o1.in.isInstanceOf[o1.Inner] //still makes sense, the path-dependent type is o1's own
o1.in.isInstanceOf[o2.Inner] //why is this true? PiS p.423 says the path-dependent types are different, they only share a common supertype Outer#Inner
나에게 버그처럼 보이지만 지우는 결과 일 수 있습니다. isInstanceOf/asInstanceOf보다 선호되는 일치는 예상대로 작동합니다. –