Skip to content

Commit ab8db8d

Browse files
committed
check module statics when resolving identifier
1 parent 37643cb commit ab8db8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/typing/typer.ml

+9
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,15 @@ let rec type_ident_raise ctx i p mode =
357357
let e = type_type ctx ctx.curclass.cl_path p in
358358
(* check_locals_masking already done in type_type *)
359359
field_access ctx mode f (FStatic (ctx.curclass,f)) (field_type ctx ctx.curclass [] f p) e p
360+
with Not_found -> try
361+
(* module-level statics *)
362+
(match ctx.m.curmod.m_statics with
363+
| None -> raise Not_found
364+
| Some c ->
365+
let f = PMap.find i c.cl_statics in
366+
let e = type_module_type ctx (TClassDecl c) None p in
367+
field_access ctx mode f (FStatic (c,f)) (field_type ctx c [] f p) e p
368+
)
360369
with Not_found -> try
361370
let wrap e = if mode = MSet then
362371
AKNo i

0 commit comments

Comments
 (0)