Open RomainTHD opened 2 years ago
Thought I'd chime in here. The test description can be found in the original pull request here. It does indeed have a confusing name. The reason for the test is to ensure attribute overloading is not allowed, even when the derived class is defined prior to the base class. Depending on compiler design, this might be an issue.
See the following file
order.jl
for theobjects1
extension, marked as a bad file in the testsuite.https://github.com/myreen/tda283/blob/0d0a91d6a4827e267953efa276d96e5d9b318444/tester/testsuite/extensions/objects1/bad/order.jl#L1-L12
The filename hints that the problem here would be that
Zoom
is defined beforeBoom
. However, it also appears that this inheritance overloads the attributea
, so the real problem isn't totally clear. Is it this attribute overload (then the file is probably incorrectly named) since we're still in the basic OOP extension, or is it the definition order?If the intended problem was the definition order, and this overload is only a typo:
While Javalette aims to be "almost a subset of C", this OOP extension is arguably closer to a Java-like language. And, in Java, the class order doesn't matter, hence the code above would be completely valid. So, shouldn't the class definition be strictly unordered (i.e. the code above would be explicitly marked as a good file instead)? Or at least implementation-defined, if you think it would add too much constraints on the language (and then simply remove this test file)? Because currently it is the only bad OOP test that would actually not be marked as bad by a Java compiler.