-
Bug
-
Resolution: Unresolved
-
P4
-
21
Two problems with 'classDimension', used to verify 'multianewarray':
- The second rule, 'classDimension(_, Dimension)' matches *all types*, including array types—so allows the dimensionality of any type to be considered 0.
- The name suggests that the element type will always be a class type, when it need not be.
Proposed revised definition:
arrayDimensions(arrayOf(X), XDimensions + 1) :-
arrayDimensions(X, XDimensions).
arrayDimensions(Type, 0) :-
Type \= arrayOf(_).
(And rename the usage in 'instructionIsTypeSafe'.)
- The second rule, 'classDimension(_, Dimension)' matches *all types*, including array types—so allows the dimensionality of any type to be considered 0.
- The name suggests that the element type will always be a class type, when it need not be.
Proposed revised definition:
arrayDimensions(arrayOf(X), XDimensions + 1) :-
arrayDimensions(X, XDimensions).
arrayDimensions(Type, 0) :-
Type \= arrayOf(_).
(And rename the usage in 'instructionIsTypeSafe'.)