-
Notifications
You must be signed in to change notification settings - Fork 488
feat: %{cmt} and %{cmti} artifact variables #12634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| - Add support for `%{cmt:...}` and `%{cmti:...}` variables to reference | ||
| compiled annotation files (.cmt and .cmti) containing typed abstract syntax | ||
| trees with location and type information. (#12634, grants #12633, @Alizter) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ type t = | |
| | Cmi | ||
| | Cmo | ||
| | Cmx | ||
| | Cmt | ||
| | Cmti | ||
|
|
||
| let compare x y : Ordering.t = | ||
| match x, y with | ||
|
|
@@ -14,18 +16,36 @@ let compare x y : Ordering.t = | |
| | Cmo, _ -> Lt | ||
| | _, Cmo -> Gt | ||
| | Cmx, Cmx -> Eq | ||
| | Cmx, _ -> Lt | ||
| | _, Cmx -> Gt | ||
| | Cmt, Cmt -> Eq | ||
| | Cmt, _ -> Lt | ||
| | _, Cmt -> Gt | ||
| | Cmti, Cmti -> Eq | ||
| ;; | ||
|
|
||
| let all = [ Cmi; Cmo; Cmx ] | ||
| let all = [ Cmi; Cmo; Cmx; Cmt; Cmti ] | ||
|
|
||
| let choose cmi cmo cmx = function | ||
| let choose cmi cmo cmx cmt cmti = function | ||
| | Cmi -> cmi | ||
| | Cmo -> cmo | ||
| | Cmx -> cmx | ||
| | Cmt -> cmt | ||
| | Cmti -> cmti | ||
| ;; | ||
|
|
||
| let ext = choose ".cmi" ".cmo" ".cmx" | ||
| let source = choose Ml_kind.Intf Impl Impl | ||
| let ext = choose ".cmi" ".cmo" ".cmx" ".cmt" ".cmti" | ||
| let source = choose Ml_kind.Intf Impl Impl Impl Intf | ||
|
|
||
| let to_dyn = | ||
| let open Dyn in | ||
| function | ||
| | Cmi -> variant "cmi" [] | ||
| | Cmo -> variant "cmo" [] | ||
| | Cmx -> variant "cmx" [] | ||
| | Cmt -> variant "cmt" [] | ||
| | Cmti -> variant "cmti" [] | ||
| ;; | ||
|
|
||
| module Dict = struct | ||
| type 'a t = | ||
|
|
@@ -38,16 +58,12 @@ module Dict = struct | |
| | Cmi -> t.cmi | ||
| | Cmo -> t.cmo | ||
| | Cmx -> t.cmx | ||
| | (Cmt | Cmti) as cm_kind -> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the right approach. The underlying issue is that your change to |
||
| Code_error.raise | ||
| "Cm_kind.Dict.get doesnt support this case" | ||
| [ "cm_kind", to_dyn cm_kind ] | ||
| ;; | ||
|
|
||
| let of_func f = { cmi = f ~cm_kind:Cmi; cmo = f ~cm_kind:Cmo; cmx = f ~cm_kind:Cmx } | ||
| let make_all x = { cmi = x; cmo = x; cmx = x } | ||
| end | ||
|
|
||
| let to_dyn = | ||
| let open Dyn in | ||
| function | ||
| | Cmi -> variant "cmi" [] | ||
| | Cmo -> variant "cmo" [] | ||
| | Cmx -> variant "cmx" [] | ||
| ;; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ type t = | |
| | Cmi | ||
| | Cmo | ||
| | Cmx | ||
| | Cmt | ||
| | Cmti | ||
|
|
||
| val compare : t -> t -> Ordering.t | ||
| val all : t list | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.