Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
The compiler should not do that. Furthermore, IMHO, any non-abstract class extending Dynamic should implement applyDynamic or an error should be returned.
(1) Preventing the compiler running away by stopping it dynamically applying a call to "applyDynamic". This is sufficient to stop this bug proper, but puts the weight on the client, as the error only shows up at the point of call.
(2) Forbidding any subclassing of scala.Dynamic without declaring an applyDynamic member -- even traits or abstract classes. Forbidding it only for concrete classes is not sufficient because intermediate abstract classes would cause the error in (1) to come up, which could be pretty mysterious if it's a library class and the user doesn't even know about Dynamic.
Note that with change (2), the only way to run into (1) will be to call a dynamic method on scala.Dynamic directly or some class file compiled with an older version of the compiler.
Please review the patch carefully both in concept and in implementation, as I am not a computer language theorist and it's my first attempt at changing the scala compiler. Tomorrow I'll try to find out how to add test cases and create some for this change.