aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-11-05 11:01:47 -0700
committerPatrick Walton <[email protected]>2010-11-05 11:02:17 -0700
commite399926776e0d1ef7ebe6d9f0d7ef6d066eabfa0 (patch)
treedf269553088b8f7c4eb8a4103e015d8e7e8a9b7d /src/boot
parentRevert "Move the option type to its own module" (diff)
downloadrust-e399926776e0d1ef7ebe6d9f0d7ef6d066eabfa0.tar.xz
rust-e399926776e0d1ef7ebe6d9f0d7ef6d066eabfa0.zip
rustboot: Report cyclic import errors at the right location
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/me/resolve.ml2
-rw-r--r--src/boot/me/semant.ml13
2 files changed, 9 insertions, 6 deletions
diff --git a/src/boot/me/resolve.ml b/src/boot/me/resolve.ml
index 86246cfb..14d9cc53 100644
--- a/src/boot/me/resolve.ml
+++ b/src/boot/me/resolve.ml
@@ -291,7 +291,7 @@ let rec lookup_type_by_name
iflog cx (fun _ ->
log cx "+++ lookup_type_by_name %a"
Ast.sprintf_name name);
- match lookup_by_name cx [] scopes name with
+ match lookup_by_name ?loc:loc cx [] scopes name with
RES_failed name' -> raise (Resolution_failure [ name', name ])
| RES_ok (scopes', id) ->
let ty, params =
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 12f973c1..6f442c33 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -1990,6 +1990,7 @@ let get_name_base_ident
type loop_check = (node_id * Ast.ident) list;;
let rec project_ident_from_items
+ ?loc:loc
(cx:ctxt)
(lchk:loop_check)
(scopes:scope list)
@@ -2009,7 +2010,7 @@ let rec project_ident_from_items
in
let lchk' = (scope_id, ident)::lchk in
let lchk_strs = List.map string_of_loop_check (List.rev lchk') in
- err (Some scope_id) "cyclic import for ident %s (%s)" ident
+ err loc "cyclic import for ident %s (%s)" ident
(String.concat " -> " lchk_strs)
else (scope_id, ident)::lchk
in
@@ -2047,6 +2048,7 @@ and project_name_comp_from_resolved
project_ident_from_items cx lchk scopes id md ident false
and lookup_by_name
+ ?loc:loc
(cx:ctxt)
(lchk:loop_check)
(scopes:scope list)
@@ -2056,12 +2058,13 @@ and lookup_by_name
match name with
Ast.NAME_base nb ->
let ident = get_name_base_ident nb in
- lookup_by_ident cx lchk scopes ident
+ lookup_by_ident ?loc:loc cx lchk scopes ident
| Ast.NAME_ext (name, ext) ->
let base_res = lookup_by_name cx lchk scopes name in
project_name_comp_from_resolved cx lchk base_res ext
and lookup_by_ident
+ ?loc:loc
(cx:ctxt)
(lchk:loop_check)
(scopes:scope list)
@@ -2120,8 +2123,8 @@ and lookup_by_ident
end
| SCOPE_crate crate ->
- project_ident_from_items
- cx lchk scopes crate.id crate.node.Ast.crate_items ident true
+ project_ident_from_items ?loc:loc cx lchk
+ scopes crate.id crate.node.Ast.crate_items ident true
| SCOPE_obj_fn fn ->
would_capture (check_slots scopes fn.node.Ast.fn_input_slots)
@@ -2137,7 +2140,7 @@ and lookup_by_ident
check_slots scopes obj.Ast.obj_state
| Ast.MOD_ITEM_mod md ->
- project_ident_from_items cx lchk
+ project_ident_from_items ?loc:loc cx lchk
scopes item.id md ident true
| _ -> no_such_ident ident