mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Scopelang: fix scope definition incorrect position
This commit is contained in:
parent
6e5e99a60a
commit
d78f004848
@ -598,12 +598,15 @@ let translate_rule
|
|||||||
(exc_graphs :
|
(exc_graphs :
|
||||||
Desugared.Dependency.ExceptionsDependencies.t D.ScopeDef.Map.t) = function
|
Desugared.Dependency.ExceptionsDependencies.t D.ScopeDef.Map.t) = function
|
||||||
| Desugared.Dependency.Vertex.Var (var, state) -> (
|
| Desugared.Dependency.Vertex.Var (var, state) -> (
|
||||||
let pos = Mark.get (ScopeVar.get_info var) in
|
|
||||||
(* TODO: this may point to the place where the variable was declared instead
|
|
||||||
of the binding in the definition being explored. Needs double-checking
|
|
||||||
and maybe adding more position information *)
|
|
||||||
let scope_def =
|
let scope_def =
|
||||||
D.ScopeDef.Map.find ((var, pos), D.ScopeDef.Var state) scope.scope_defs
|
D.ScopeDef.Map.find
|
||||||
|
((var, Pos.no_pos), D.ScopeDef.Var state)
|
||||||
|
scope.scope_defs
|
||||||
|
in
|
||||||
|
let pos =
|
||||||
|
match RuleName.Map.choose_opt scope_def.scope_def_rules with
|
||||||
|
| None -> Mark.get (ScopeVar.get_info var)
|
||||||
|
| Some (r, _) -> Mark.get (RuleName.get_info r)
|
||||||
in
|
in
|
||||||
match ScopeVar.Map.find_opt var scope.scope_sub_scopes with
|
match ScopeVar.Map.find_opt var scope.scope_sub_scopes with
|
||||||
| None -> (
|
| None -> (
|
||||||
|
Loading…
Reference in New Issue
Block a user