Aligning implementation/specification error codes - phase 4 - #1993
Aligning implementation/specification error codes - phase 4#1993Roman-Manevich wants to merge 9 commits into
Conversation
3ec2709 to
6ac171a
Compare
| | BadField of string * ty | ||
| | MissingField of string list * ty | ||
| | BadSlices of error_handling_time * slice list * int | ||
| | BadIndex of error_handling_time * int * int |
There was a problem hiding this comment.
worth a record I think
There was a problem hiding this comment.
I prefer records, but why this specific one and not all other constructors with multiple fields?
There was a problem hiding this comment.
I can see at least two reasons:
- A record clearly differentiates between the two arguments with the same
inttype. - This constructor was added in this PR - we can make it better quality than other constructors without being inconsistent.
There was a problem hiding this comment.
In general, I want to prevent this type of error: you have switched your arguments around and the type system does not catch it.
For example, it is not obvious that this code is wrong, and it will be accepted by the ocaml type-checker:
fatal ~loc (Error.BadIndex (Static, actual, expected))By naming things we can make this class of errors far more difficult to happen:
fatal ~loc (Error.BadIndex { error_handling_time = Static; actual; expected })This is the same reasoning for naming arguments to functions. The only exception to this is when it things are left-to-right ordered, e.g. plus x y makes as much sense as plus ~lhs:x ~rhs:y.
| File static-evaluation-non-literal.asl, line 5, characters 13 to 24: | ||
| constant C = R { x = 1 }; | ||
| ^^^^^^^^^^^ | ||
| ASL Type error (TE_SEF): Static evaluation of expression R { x = 1 } failed. |
There was a problem hiding this comment.
Oh I had forgotten we had this limitation. Could we put it on a ticket please?
There was a problem hiding this comment.
I'm not sure what you want the ticket to say.
There was a problem hiding this comment.
Well that ASLRef does not support initialising constants with compound expressions when it is not forbidden by type-checking?
6ac171a to
6589fe9
Compare
6589fe9 to
d963482
Compare
d963482 to
bd22e37
Compare
hrutvik
left a comment
There was a problem hiding this comment.
Please ensure @HadrienRenaud has approved before merging.
| [1] | ||
|
|
||
| Implementation errors: | ||
| $ aslref --gnu-errors implementation-integer-overflow.asl |
There was a problem hiding this comment.
nit: why --gnu-errors here?
bd22e37 to
43d4191
Compare
Classify unsupported parameter expressions
Expressions that cannot define subprogram parameters now report
TE_BSPDthroughBadParameterExpr, matchingparams_of_exprinasl.spec.Classify invalid collection field types
Non-bitvector collection fields now report
TE_UTthroughcheck_structure_bits, matching the per-fieldcheck_structure_labelchecks inasl.spec.Classify unsupported parameter types
Types not permitted as subprogram argument or return types now report
TE_BSPDthroughBadParameterType;asl.specand a documented regression now cover pending-constrained integers, and the obsoleteUnsupportedTydiagnostic is removed.Classify out-of-bounds indices
Out-of-bounds native vector accesses now report
DE_BI, orTE_SEFduring static evaluation, throughBadIndexinstead of the uncodedMismatchTypediagnostic.Classify arbitrary negative-length arrays
Parameterized arrays whose length evaluates negatively now report
DE_AETthroughArbitraryEmptyType, matchingEArbitraryinasl.spec.Classify static evaluation failures
Static evaluation that does not produce a literal now reports
TE_SEFthroughStaticEvaluationFailure, matchingstatic_evalinasl.spec.Classify implementation integer overflow
Integers exceeding OCaml
intlimits now report a structured internalImplementationIntegerOverflowdiagnostic instead of the uncodedUnsupportedExpr.