Skip to content

Commit

Permalink
[asl] fix a few error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienRenaud committed Oct 29, 2024
1 parent 6e5130a commit 2170a86
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 80 deletions.
34 changes: 17 additions & 17 deletions asllib/error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ module PPrint = struct
| UndefinedIdentifier s ->
fprintf f "ASL Error: Undefined identifier:@ '%s'" s
| MismatchedReturnValue s ->
fprintf f "ASL Error: Mismatched use of return value from call to '%s'"
fprintf f "ASL Error: Mismatched use of return value from call to '%s'."
s
| BadArity (name, expected, provided) ->
fprintf f
"ASL Error: Arity error while calling '%s':@ %d arguments expected \
and %d provided"
and %d provided."
name expected provided
| NotYetImplemented s ->
pp_print_text f @@ "ASL Internal error: Not yet implemented: " ^ s
Expand All @@ -186,23 +186,23 @@ module PPrint = struct
(pp_comma_list pp_type_desc)
expected
| AssertionFailed e ->
fprintf f "ASL Execution error: Assertion failed:@ %a" pp_expr e
fprintf f "ASL Execution error: Assertion failed:@ %a." pp_expr e
| CannotParse -> pp_print_string f "ASL Error: Cannot parse."
| UnknownSymbol -> pp_print_string f "ASL Error: Unknown symbol."
| NoCallCandidate (name, types) ->
fprintf f
"ASL Typing error: No subprogram declaration matches the \
invocation:@ %s(%a)"
invocation:@ %s(%a)."
name (pp_comma_list pp_ty) types
| TooManyCallCandidates (name, types) ->
fprintf f
"ASL Typing error: Too many subprogram declaration match the \
invocation:@ %s(%a)"
invocation:@ %s(%a)."
name (pp_comma_list pp_ty) types
| BadTypesForBinop (op, t1, t2) ->
fprintf f
"ASL Typing error: Illegal application of operator %s on types@ %a@ \
and %a"
and %a."
(binop_to_string op) pp_ty t1 pp_ty t2
| CircularDeclarations x ->
fprintf f
Expand All @@ -211,7 +211,7 @@ module PPrint = struct
x
| ImpureExpression e ->
fprintf f
"ASL Typing error:@ a pure expression was expected,@ found@ %a"
"ASL Typing error:@ a pure expression was expected,@ found@ %a."
pp_expr e
| UnreconciliableTypes (t1, t2) ->
fprintf f
Expand All @@ -228,41 +228,41 @@ module PPrint = struct
| BadReturnStmt None ->
pp_print_text f
"ASL Typing error: cannot return something from a procedure."
| UnexpectedSideEffect s -> fprintf f "Unexpected side-effect: %s" s
| UncaughtException s -> fprintf f "Uncaught exception: %s" s
| UnexpectedSideEffect s -> fprintf f "Unexpected side-effect: %s." s
| UncaughtException s -> fprintf f "Uncaught exception: %s." s
| OverlappingSlices slices ->
fprintf f "ASL Typing error:@ overlapping slices@ @[%a@]." pp_slice_list
slices
| BadLDI ldi ->
fprintf f "Unsupported declaration:@ @[%a@]." pp_local_decl_item ldi
| BadRecursiveDecls decls ->
fprintf f "ASL Typing error:@ multiple recursive declarations:@ @[%a@]"
fprintf f "ASL Typing error:@ multiple recursive declarations:@ @[%a@]."
(pp_comma_list (fun f -> fprintf f "%S"))
decls
| UnrespectedParserInvariant -> fprintf f "Parser invariant broke."
| ConstrainedIntegerExpected t ->
fprintf f
"ASL Typing error:@ constrained@ integer@ expected,@ provided@ %a"
"ASL Typing error:@ constrained@ integer@ expected,@ provided@ %a."
pp_ty t
| ParameterWithoutDecl s ->
fprintf f
"ASL Typing error:@ explicit@ parameter@ %S@ does@ not@ have@ a@ \
corresponding@ defining@ argument"
corresponding@ defining@ argument."
s
| BaseValueEmptyType t ->
fprintf f "ASL Typing error: base value of empty type %a" pp_ty t
fprintf f "ASL Typing error: base value of empty type %a." pp_ty t
| BaseValueNonStatic (t, e) ->
fprintf f
"ASL Typing error: base value of type %a containing non-static value \
%a"
"ASL Typing error:@ base@ value@ of@ type@ %a@ containing@ \
non-static@ value@ %a."
pp_ty t pp_expr e
| BadATC (t1, t2) ->
fprintf f
"ASL Typing error:@ cannot@ perform@ Asserted@ Type@ Conversion@ on@ \
%a@ by@ %a."
pp_ty t1 pp_ty t2
| SettingIntersectingSlices bitfields ->
fprintf f "ASL Typing error:@ setting@ intersecting@ bitfields@ [%a]"
fprintf f "ASL Typing error:@ setting@ intersecting@ bitfields@ [%a]."
pp_bitfields bitfields
| SetterWithoutCorrespondingGetter func ->
let ret, args =
Expand All @@ -272,7 +272,7 @@ module PPrint = struct
in
fprintf f
"ASL Typing error:@ setter@ \"%s\"@ does@ not@ have@ a@ \
corresponding@ getter@ of@ signature@ @[@[%a@]@ ->@ %a@]"
corresponding@ getter@ of@ signature@ @[@[%a@]@ ->@ %a@]."
func.name (pp_comma_list pp_ty) args pp_ty ret
| UnexpectedATC -> pp_print_text f "ASL Typing error: unexpected ATC."
| BadReturnStmt (Some t) ->
Expand Down
10 changes: 5 additions & 5 deletions asllib/tests/ASLSemanticsReference.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ASL Semantics Reference:
File SemanticsRule.EBinopDIVBackendDefinedError.asl, line 4,
characters 10 to 17:
ASL Typing error: Illegal application of operator DIV on types integer {3}
and integer {0}
and integer {0}.
[1]
$ aslref --no-type-check SemanticsRule.EBinopDIVBackendDefinedError.asl
File SemanticsRule.EBinopDIVBackendDefinedError.asl, line 4,
Expand All @@ -35,7 +35,7 @@ ASL Semantics Reference:
$ aslref SemanticsRule.ECondFALSE.asl
$ aslref SemanticsRule.ECondUNKNOWN3or42.asl
File SemanticsRule.ECondUNKNOWN3or42.asl, line 10, characters 9 to 13:
ASL Execution error: Assertion failed: (x == 3)
ASL Execution error: Assertion failed: (x == 3).
[1]
$ aslref SemanticsRule.ESlice.asl
$ aslref SemanticsRule.ECall.asl
Expand All @@ -50,13 +50,13 @@ ASL Semantics Reference:
$ aslref SemanticsRule.EUnknownInteger0.asl
$ aslref SemanticsRule.EUnknownInteger3.asl
File SemanticsRule.EUnknownInteger3.asl, line 5, characters 9 to 13:
ASL Execution error: Assertion failed: (x == 3)
ASL Execution error: Assertion failed: (x == 3).
[1]
$ aslref SemanticsRule.EUnknownIntegerRange3-42-3.asl
$ aslref SemanticsRule.EUnknownIntegerRange3-42-42.asl
File SemanticsRule.EUnknownIntegerRange3-42-42.asl, line 5,
characters 9 to 14:
ASL Execution error: Assertion failed: (x == 42)
ASL Execution error: Assertion failed: (x == 42).
[1]
$ aslref SemanticsRule.EPatternFALSE.asl
$ aslref SemanticsRule.EPatternTRUE.asl
Expand Down Expand Up @@ -157,7 +157,7 @@ ASL Semantics Reference:
$ aslref SemanticsRule.SAssertOk.asl
$ aslref SemanticsRule.SAssertNo.asl
File SemanticsRule.SAssertNo.asl, line 4, characters 10 to 17:
ASL Execution error: Assertion failed: (42 == 3)
ASL Execution error: Assertion failed: (42 == 3).
[1]
$ aslref SemanticsRule.LEDiscard.asl
$ aslref SemanticsRule.LDDiscard.asl
20 changes: 10 additions & 10 deletions asllib/tests/division.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ Division by zero:
constraints {0} would fail with op DIV, operation will always fail.
File static-div-zero.asl, line 3, characters 19 to 26:
ASL Typing error: Illegal application of operator DIV on types integer {6}
and integer {0}
and integer {0}.
[1]

$ aslref static-divrm-zero.asl
File static-divrm-zero.asl, line 3, characters 19 to 28: All values in
constraints {0} would fail with op DIVRM, operation will always fail.
File static-divrm-zero.asl, line 3, characters 19 to 28:
ASL Typing error: Illegal application of operator DIVRM on types integer {6}
and integer {0}
and integer {0}.
[1]

$ aslref static-mod-zero.asl
File static-mod-zero.asl, line 3, characters 19 to 26: All values in
constraints {0} would fail with op MOD, operation will always fail.
File static-mod-zero.asl, line 3, characters 19 to 26:
ASL Typing error: Illegal application of operator MOD on types integer {6}
and integer {0}
and integer {0}.
[1]

Unsupported divisions (caught at type-checking time):
Expand All @@ -34,45 +34,45 @@ Unsupported divisions (caught at type-checking time):
constraints {(- 3)} would fail with op DIV, operation will always fail.
File static-div-neg.asl, line 3, characters 19 to 27:
ASL Typing error: Illegal application of operator DIV on types integer {6}
and integer {(- 3)}
and integer {(- 3)}.
[1]

$ aslref static-divrm-neg.asl
File static-divrm-neg.asl, line 3, characters 19 to 29: All values in
constraints {(- 3)} would fail with op DIVRM, operation will always fail.
File static-divrm-neg.asl, line 3, characters 19 to 29:
ASL Typing error: Illegal application of operator DIVRM on types integer {6}
and integer {(- 3)}
and integer {(- 3)}.
[1]

$ aslref static-mod-neg.asl
File static-mod-neg.asl, line 3, characters 19 to 27: All values in
constraints {(- 3)} would fail with op MOD, operation will always fail.
File static-mod-neg.asl, line 3, characters 19 to 27:
ASL Typing error: Illegal application of operator MOD on types integer {6}
and integer {(- 3)}
and integer {(- 3)}.
[1]

$ aslref --no-exec static-div-undiv.asl
File static-div-undiv.asl, line 3, characters 19 to 26: All values in
constraints {(5 DIV 3)} would fail with op DIV, operation will always fail.
File static-div-undiv.asl, line 3, characters 19 to 26:
ASL Typing error: Illegal application of operator DIV on types integer {5}
and integer {3}
and integer {3}.
[1]
$ aslref --no-exec static-div-undiv-bis.asl
File static-div-undiv-bis.asl, line 3, characters 11 to 18: All values in
constraints {(1 DIV 2)} would fail with op DIV, operation will always fail.
File static-div-undiv-bis.asl, line 3, characters 11 to 18:
ASL Typing error: Illegal application of operator DIV on types integer {1}
and integer {2}
and integer {2}.
[1]
$ aslref static-div-undiv-bis.asl
File static-div-undiv-bis.asl, line 3, characters 11 to 18: All values in
constraints {(1 DIV 2)} would fail with op DIV, operation will always fail.
File static-div-undiv-bis.asl, line 3, characters 11 to 18:
ASL Typing error: Illegal application of operator DIV on types integer {1}
and integer {2}
and integer {2}.
[1]
$ aslref --no-exec static-div-undiv-ter.asl
File static-div-undiv-ter.asl, line 4, characters 10 to 17:
Expand Down Expand Up @@ -155,7 +155,7 @@ Other polynomial equations:
$ aslref rat-poly-00.asl
File rat-poly-00.asl, line 15, characters 9 to 19:
ASL Typing error: Illegal application of operator == on types bits((7 DIV 2))
and bits(3)
and bits(3).
[1]

$ aslref rat-poly-01.asl
Expand Down
2 changes: 1 addition & 1 deletion asllib/tests/print.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
$ aslref printer2.asl
File printer2.asl, line 2, characters 16 to 24:
ASL Typing error: Illegal application of operator + on types integer {2}
and real
and real.
[1]
8 changes: 4 additions & 4 deletions asllib/tests/recursive.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

$ aslref double-recursive-constant.asl
File double-recursive-constant.asl, line 2, characters 0 to 19:
ASL Typing error: multiple recursive declarations: "y", "x"
ASL Typing error: multiple recursive declarations: "y", "x".
[1]

$ aslref recursive-type.asl
Expand All @@ -19,17 +19,17 @@

$ aslref double-recursive-types.asl
File double-recursive-types.asl, line 2, characters 0 to 29:
ASL Typing error: multiple recursive declarations: "node", "tree"
ASL Typing error: multiple recursive declarations: "node", "tree".
[1]

$ aslref fn-val-recursive.asl
File fn-val-recursive.asl, line 1, characters 0 to 17:
ASL Typing error: multiple recursive declarations: "f", "x"
ASL Typing error: multiple recursive declarations: "f", "x".
[1]

$ aslref type-val-recursive.asl
File type-val-recursive.asl, line 3, characters 0 to 24:
ASL Typing error: multiple recursive declarations: "MyT", "x"
ASL Typing error: multiple recursive declarations: "MyT", "x".
[1]

$ aslref enum-fn-recursive.asl
Expand Down
Loading

0 comments on commit 2170a86

Please sign in to comment.