From a1ee29ce773f3a624f9fb9d7d5980103a97de181 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 27 Jan 2022 22:26:30 +0100 Subject: [PATCH] get the module `VarE`'s type right --- src/lowering/desugar.ml | 6 ++++-- test/run/ok/import-module-explicit.comp.ok | 5 ----- test/run/ok/import-module-explicit.comp.ret.ok | 1 - test/run/ok/import-module-explicit.diff-ir.ok | 8 -------- test/run/ok/import-module-explicit.diff-low.ok | 8 -------- test/run/ok/import-module-explicit.run-ir.ok | 5 ----- test/run/ok/import-module-explicit.run-ir.ret.ok | 1 - test/run/ok/import-module-explicit.run-low.ok | 5 ----- test/run/ok/import-module-explicit.run-low.ret.ok | 1 - 9 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 test/run/ok/import-module-explicit.comp.ok delete mode 100644 test/run/ok/import-module-explicit.comp.ret.ok delete mode 100644 test/run/ok/import-module-explicit.diff-ir.ok delete mode 100644 test/run/ok/import-module-explicit.diff-low.ok delete mode 100644 test/run/ok/import-module-explicit.run-ir.ok delete mode 100644 test/run/ok/import-module-explicit.run-ir.ret.ok delete mode 100644 test/run/ok/import-module-explicit.run-low.ok delete mode 100644 test/run/ok/import-module-explicit.run-low.ret.ok diff --git a/src/lowering/desugar.ml b/src/lowering/desugar.ml index 459db59371a..c3bd585fb1e 100644 --- a/src/lowering/desugar.ml +++ b/src/lowering/desugar.ml @@ -859,7 +859,9 @@ let link_declarations imports (cu, flavor) = let transform_import (i : S.import) : import_declaration = let (mid, f, ir) = i.it in - let t = i.note in + let t = match mid with + | Surface _ -> i.note + | Bulk (_, mod_note) -> mod_note.note_typ in assert (t <> T.Pre); let rhs = match !ir with | S.Unresolved -> raise (Invalid_argument ("Unresolved import " ^ f)) @@ -871,7 +873,7 @@ let transform_import (i : S.import) : import_declaration = primE (I.ActorOfIdBlob t) [blobE canister_id] in [ match mid with | Surface id -> letD (var id.it t) rhs - | Bulk (id, _) -> letD (var id.it t) (dotE rhs id.it t)] + | Bulk (id, _) -> letD (var id.it i.note) (dotE rhs id.it i.note)] let transform_unit_body (u : S.comp_unit_body) : Ir.comp_unit = match u.it with diff --git a/test/run/ok/import-module-explicit.comp.ok b/test/run/ok/import-module-explicit.comp.ok deleted file mode 100644 index 4c70d344f2a..00000000000 --- a/test/run/ok/import-module-explicit.comp.ok +++ /dev/null @@ -1,5 +0,0 @@ -Ill-typed intermediate code after Desugaring (use -v to see dumped IR): -(unknown location): IR type error [M0000], subtype violation: - module {type List = ?(T, List); cons : (T, List) -> List; nil : () -> List} - (T, List) -> List - diff --git a/test/run/ok/import-module-explicit.comp.ret.ok b/test/run/ok/import-module-explicit.comp.ret.ok deleted file mode 100644 index 69becfa16f9..00000000000 --- a/test/run/ok/import-module-explicit.comp.ret.ok +++ /dev/null @@ -1 +0,0 @@ -Return code 1 diff --git a/test/run/ok/import-module-explicit.diff-ir.ok b/test/run/ok/import-module-explicit.diff-ir.ok deleted file mode 100644 index 5d623fc2c55..00000000000 --- a/test/run/ok/import-module-explicit.diff-ir.ok +++ /dev/null @@ -1,8 +0,0 @@ ---- import-module-explicit.run -+++ import-module-explicit.run-ir -@@ -0,0 +1,5 @@ -+Ill-typed intermediate code after Desugaring (use -v to see dumped IR): -+(unknown location): IR type error [M0000], subtype violation: -+ module {type List = ?(T, List); cons : (T, List) -> List; nil : () -> List} -+ (T, List) -> List -+ diff --git a/test/run/ok/import-module-explicit.diff-low.ok b/test/run/ok/import-module-explicit.diff-low.ok deleted file mode 100644 index 156a3fc43f6..00000000000 --- a/test/run/ok/import-module-explicit.diff-low.ok +++ /dev/null @@ -1,8 +0,0 @@ ---- import-module-explicit.run -+++ import-module-explicit.run-low -@@ -0,0 +1,5 @@ -+Ill-typed intermediate code after Desugaring (use -v to see dumped IR): -+(unknown location): IR type error [M0000], subtype violation: -+ module {type List = ?(T, List); cons : (T, List) -> List; nil : () -> List} -+ (T, List) -> List -+ diff --git a/test/run/ok/import-module-explicit.run-ir.ok b/test/run/ok/import-module-explicit.run-ir.ok deleted file mode 100644 index 4c70d344f2a..00000000000 --- a/test/run/ok/import-module-explicit.run-ir.ok +++ /dev/null @@ -1,5 +0,0 @@ -Ill-typed intermediate code after Desugaring (use -v to see dumped IR): -(unknown location): IR type error [M0000], subtype violation: - module {type List = ?(T, List); cons : (T, List) -> List; nil : () -> List} - (T, List) -> List - diff --git a/test/run/ok/import-module-explicit.run-ir.ret.ok b/test/run/ok/import-module-explicit.run-ir.ret.ok deleted file mode 100644 index 69becfa16f9..00000000000 --- a/test/run/ok/import-module-explicit.run-ir.ret.ok +++ /dev/null @@ -1 +0,0 @@ -Return code 1 diff --git a/test/run/ok/import-module-explicit.run-low.ok b/test/run/ok/import-module-explicit.run-low.ok deleted file mode 100644 index 4c70d344f2a..00000000000 --- a/test/run/ok/import-module-explicit.run-low.ok +++ /dev/null @@ -1,5 +0,0 @@ -Ill-typed intermediate code after Desugaring (use -v to see dumped IR): -(unknown location): IR type error [M0000], subtype violation: - module {type List = ?(T, List); cons : (T, List) -> List; nil : () -> List} - (T, List) -> List - diff --git a/test/run/ok/import-module-explicit.run-low.ret.ok b/test/run/ok/import-module-explicit.run-low.ret.ok deleted file mode 100644 index 69becfa16f9..00000000000 --- a/test/run/ok/import-module-explicit.run-low.ret.ok +++ /dev/null @@ -1 +0,0 @@ -Return code 1