SDK 8 introduces unannounced changes in member lookup rules.
The following code contains some classes and modules along with two mutually exclusive tests. The first test passes in SDK 7, but fails in SDK 8, while another one fails in 7, but passes in 8.
Compiler options are -w -l 3 -O 3z
.
import Toybox.Lang; import Toybox.Test; module M { class A { static function a() as String { return "module"; } } class B { function b() as String { return A.a(); } } } class A { static function a() as String { return "global"; } } class B extends M.B { function initialize() { M.B.initialize(); } } class T { static function getValue() as String { return (new B()).b(); } (:test) static function passIn7_failIn8(logger as Logger) as Boolean { return "module".equals(getValue()); } (:test) static function failIn7_passIn8(logger as Logger) as Boolean { return "global".equals(getValue()); } }
These changes, which I hope are not intentional, can cause various errors from weird runtime "Symbol Not Found Error", as in my original case, to unexpected results of program execution, as in the example above.