propagate source-code locations to ast_typed
This commit is contained in:
parent
5b42d72e41
commit
79af0abab3
@ -2,7 +2,13 @@ open Trace
|
|||||||
open Types
|
open Types
|
||||||
|
|
||||||
let make_t type_value' simplified = { type_value' ; simplified }
|
let make_t type_value' simplified = { type_value' ; simplified }
|
||||||
let make_a_e expression type_annotation environment = { expression ; type_annotation ; dummy_field = () ; environment }
|
let make_a_e ?(location = Location.generated) expression type_annotation environment = {
|
||||||
|
expression ;
|
||||||
|
type_annotation ;
|
||||||
|
dummy_field = () ;
|
||||||
|
environment ;
|
||||||
|
location ;
|
||||||
|
}
|
||||||
let make_n_e name a_e = { name ; annotated_expression = a_e }
|
let make_n_e name a_e = { name ; annotated_expression = a_e }
|
||||||
let make_n_t type_name type_value = { type_name ; type_value }
|
let make_n_t type_name type_value = { type_name ; type_value }
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ and annotated_expression = {
|
|||||||
expression : expression ;
|
expression : expression ;
|
||||||
type_annotation : tv ;
|
type_annotation : tv ;
|
||||||
environment : full_environment ;
|
environment : full_environment ;
|
||||||
|
location : Location.t ;
|
||||||
dummy_field : unit ;
|
dummy_field : unit ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
|
|||||||
match tv_opt with
|
match tv_opt with
|
||||||
| None -> ok ()
|
| None -> ok ()
|
||||||
| Some tv' -> O.assert_type_value_eq (tv' , tv) in
|
| Some tv' -> O.assert_type_value_eq (tv' , tv) in
|
||||||
ok @@ make_a_e expr tv e in
|
let location = Location.get_location ae in
|
||||||
|
ok @@ make_a_e ~location expr tv e in
|
||||||
let main_error =
|
let main_error =
|
||||||
let title () = "typing expression" in
|
let title () = "typing expression" in
|
||||||
let content () = Format.asprintf "Expression: %a\nLog: %s\n" I.PP.expression ae (L.get()) in
|
let content () = Format.asprintf "Expression: %a\nLog: %s\n" I.PP.expression ae (L.get()) in
|
||||||
|
1
vendors/ligo-utils/simple-utils/location.ml
vendored
1
vendors/ligo-utils/simple-utils/location.ml
vendored
@ -30,6 +30,7 @@ type 'a wrap = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let wrap ?(loc = generated) wrap_content = { wrap_content ; location = loc }
|
let wrap ?(loc = generated) wrap_content = { wrap_content ; location = loc }
|
||||||
|
let get_location x = x.location
|
||||||
let unwrap { wrap_content ; _ } = wrap_content
|
let unwrap { wrap_content ; _ } = wrap_content
|
||||||
let map f x = { x with wrap_content = f x.wrap_content }
|
let map f x = { x with wrap_content = f x.wrap_content }
|
||||||
let pp_wrap f ppf { wrap_content ; _ } = Format.fprintf ppf "%a" f wrap_content
|
let pp_wrap f ppf { wrap_content ; _ } = Format.fprintf ppf "%a" f wrap_content
|
||||||
|
Loading…
Reference in New Issue
Block a user