Skip to content

Commit

Permalink
Reinstated old sharing rules as default (#1045)
Browse files Browse the repository at this point in the history
In #1032, the original rules for sharing of implicit effect variables between a last arrow and a following type alias were completely replaced by the new inference-based rule. This PR removes the new sharing rule from the default setting.

See [this review](#1043 (review)).

Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
  • Loading branch information
samo-novak and dhil authored Aug 31, 2021
1 parent 22acfa2 commit 1429872
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions core/types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@ module Policy = struct
| AllImplicitArrowsShare
type t = opt list

let default_opts = [PresenceOmit ; AliasOmit ; ContractOperationArrows ; ArrowsCurriedHideFresh ; FinalArrowSharesWithAlias ]
let default_opts = [PresenceOmit ; AliasOmit ; ContractOperationArrows ; ArrowsCurriedHideFresh ]

let all_opts = [ PresenceOmit
; AliasOmit
Expand Down Expand Up @@ -2100,8 +2100,8 @@ module Policy = struct
-> OpenDefault
| "final_arrow_shares_with_alias" | "final_arrow"
-> FinalArrowSharesWithAlias
| "all_implicit_arrows_share" | "all_arrows" ->
AllImplicitArrowsShare
| "all_implicit_arrows_share" | "all_arrows"
-> AllImplicitArrowsShare
| _ -> failwith ("Invalid option: " ^ s)
in
let is_correct : opt list -> bool
Expand All @@ -2113,7 +2113,8 @@ module Policy = struct
| "default" -> default_opts
| "all" -> all_opts
| _ -> let lst = List.map parse_opt (Settings.parse_paths s) in
if is_correct lst then lst
if is_correct lst
then lst
else failwith "Options cannot be duplicated."

let syno
Expand All @@ -2135,17 +2136,16 @@ module Policy = struct
; " * open_default [open]: effect rows are open by default,"
; " closed with syntax { | .}"
; " * final_arrow_shares_with_alias [final_arrow]: final arrow and"
; " a following type alias will be assumed to share implicit effects"
; " (This is only a desugaring setting)."
; " a following type alias may share the implicit effect variable"
; " * all_implicit_arrows_share [all_arrows]: all arrows with implicit"
; " effect vars will be unified"
; " effect vars will be unified (experimental)"
; "Meta-options:"
; " * none: turn all of the above off"
; " * default: revert to default configuration"
; " enables \"" ^ (shortcuts_of_opts default_opts) ^ "\""
; " * all: turn all of the options on"]
in
let buf = Buffer.create 800 in
let buf = Buffer.create 1000 in
let indent = String.make 15 ' ' in
Buffer.add_string buf fst;
List.iter (fun x -> Buffer.add_string buf "\n";
Expand Down
2 changes: 1 addition & 1 deletion tests/handlers.tests
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,4 @@ Examples
./examples/handlers/tests.links
filemode : true
stdout : () : ()
args : --enable-handlers --path=examples/handlers --set=effect_sugar=true
args : --enable-handlers --path=examples/handlers --set=effect_sugar=true --set=effect_sugar_policy=final_arrow
4 changes: 2 additions & 2 deletions tests/typecheck_examples.tests
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ args : --set=effect_sugar=true
Typecheck example file examples/handlers/fringe.links
examples/handlers/fringe.links
filemode : true
args : --set=effect_sugar=true
args : --set=effect_sugar=true --set=effect_sugar_policy=final_arrow

Typecheck example file examples/handlers/identity.links
examples/handlers/identity.links
Expand All @@ -245,7 +245,7 @@ filemode : true
Typecheck example file examples/handlers/monadic_reflection.links
examples/handlers/monadic_reflection.links
filemode : true
args : --set=effect_sugar=true
args : --set=effect_sugar=true --set=effect_sugar_policy=final_arrow

Typecheck example file examples/handlers/nim.links
examples/handlers/nim.links
Expand Down

0 comments on commit 1429872

Please sign in to comment.