Skip to content

Commit c9fad7c

Browse files
authored
Avoid Global Set Asymmetric Patterns (#408)
Instead, add `Set Asymmetric Patterns` to the files that need it, or use `Arguments` to make inductive types work better with symmetric patterns. Closes: #403
1 parent 8eaff6b commit c9fad7c

File tree

8 files changed

+13
-5
lines changed

8 files changed

+13
-5
lines changed

backend/Inlining.v

+5-2
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,13 @@ Inductive inline_decision (ros: reg + ident) : Type :=
293293
| Cannot_inline
294294
| Can_inline (id: ident) (f: function) (P: ros = inr reg id) (Q: fenv!id = Some f).
295295

296+
Arguments Cannot_inline {ros}.
297+
Arguments Can_inline {ros}.
298+
296299
Program Definition can_inline (ros: reg + ident): inline_decision ros :=
297300
match ros with
298-
| inl r => Cannot_inline _
299-
| inr id => match fenv!id with Some f => Can_inline _ id f _ _ | None => Cannot_inline _ end
301+
| inl r => Cannot_inline
302+
| inr id => match fenv!id with Some f => Can_inline id f _ _ | None => Cannot_inline end
300303
end.
301304

302305
(** Inlining of a call to function [f]. An appropriate context is

cfrontend/Ctypes.v

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Require Import Axioms Coqlib Maps Errors.
2020
Require Import AST Linking.
2121
Require Archi.
2222

23+
Set Asymmetric Patterns.
24+
2325
Local Open Scope error_monad_scope.
2426

2527
(** * Syntax of types *)

common/Behaviors.v

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Require Import Integers.
2525
Require Import Smallstep.
2626

2727
Set Implicit Arguments.
28+
Set Asymmetric Patterns.
2829

2930
(** * Behaviors for program executions *)
3031

common/Linking.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ Infix ":::" := pass_cons (at level 60, right associativity) : linking_scope.
869869
Fixpoint compose_passes (l l': Language) (passes: Passes l l') : Pass l l' :=
870870
match passes in Passes l l' return Pass l l' with
871871
| pass_nil l => pass_identity l
872-
| pass_cons l1 l2 l3 pass1 passes => pass_compose pass1 (compose_passes passes)
872+
| pass_cons pass1 passes => pass_compose pass1 (compose_passes passes)
873873
end.
874874

875875
(** Some more lemmas about [nlist_forall2]. *)

lib/Coqlib.v

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ Require Export List.
2525
Require Export Bool.
2626
Require Export Lia.
2727

28-
Global Set Asymmetric Patterns.
29-
3028
(** * Useful tactics *)
3129

3230
Ltac inv H := inversion H; clear H; subst.

lib/Floats.v

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Import ListNotations.
2626

2727
Close Scope R_scope.
2828
Open Scope Z_scope.
29+
Set Asymmetric Patterns.
2930

3031
Definition float := binary64. (**r the type of IEE754 double-precision FP numbers *)
3132
Definition float32 := binary32. (**r the type of IEE754 single-precision FP numbers *)

lib/Iteration.v

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Require Import Axioms.
2020
Require Import Coqlib.
2121
Require Import Wfsimpl.
2222

23+
Set Asymmetric Patterns.
24+
2325
(** This modules defines several Coq encodings of a general "while" loop.
2426
The loop is presented in functional style as the iteration
2527
of a [step] function of type [A -> B + A]:

lib/UnionFind.v

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Require Import Coqlib.
2121

2222
Open Scope nat_scope.
2323
Set Implicit Arguments.
24+
Set Asymmetric Patterns.
2425

2526
(* To avoid useless definitions of inductors in extracted code. *)
2627
Local Unset Elimination Schemes.

0 commit comments

Comments
 (0)