> On Aug 18, 2016, at 8:21 PM, Ben Rimmington via swift-evolution > <swift-evolution@swift.org> wrote: > > >> On 18 Aug 2016, at 16:32, John McCall <rjmcc...@apple.com> wrote: >> >> Unapplied method references still dispatch down. It's a pretty simple >> experiment to run for yourself. > > When I tried calling a specific superclass implementation, there was a stack > overflow due to the infinite recursion.
This is because calling Once.value() with an instance of Twice still dispatches to Twice::value(). > > class Once { > func value() -> Int { > return 1 > } > } > > class Twice: Once { > override func value() -> Int { > return 2 > } > } > > class Thrice: Twice { > override func value() -> Int { > return 3 > > // EXC_BAD_ACCESS: > // return Once.value(self)() > } > } > > let once = Once() > once.value() //-> 1 > Once.value(once)() //-> 1 > > let twice = Twice() > twice.value() //-> 2 > Once.value(twice)() //-> 2 > Twice.value(twice)() //-> 2 > > let thrice = Thrice() > thrice.value() //-> 3 > Once.value(thrice)() //-> 3 > Twice.value(thrice)() //-> 3 > Thrice.value(thrice)() //-> 3 > > -- Ben > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution