From f4465af8fac9bf65dbd5e1941efd0a7b0c04fdf5 Mon Sep 17 00:00:00 2001 From: Gary Miller Date: Mon, 17 Apr 2023 14:20:50 +1000 Subject: [PATCH] fix circular ref testing --- adl/tests/test32/test32a.adl | 9 +++++++++ adl/tests/test32/test32b.adl | 9 +++++++++ adl/tests/testing_table.json | 1 + rust/compiler/src/processing/resolver.rs | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 adl/tests/test32/test32a.adl create mode 100644 adl/tests/test32/test32b.adl diff --git a/adl/tests/test32/test32a.adl b/adl/tests/test32/test32a.adl new file mode 100644 index 00000000..4984c897 --- /dev/null +++ b/adl/tests/test32/test32a.adl @@ -0,0 +1,9 @@ + +module test32a +{ + import test32b.Y; + + struct X { + Y field; + }; +}; \ No newline at end of file diff --git a/adl/tests/test32/test32b.adl b/adl/tests/test32/test32b.adl new file mode 100644 index 00000000..0de817ad --- /dev/null +++ b/adl/tests/test32/test32b.adl @@ -0,0 +1,9 @@ + +module test32b +{ + import test32a.X; + + struct Y { + X field; + }; +}; \ No newline at end of file diff --git a/adl/tests/testing_table.json b/adl/tests/testing_table.json index d7169e18..025a7afc 100644 --- a/adl/tests/testing_table.json +++ b/adl/tests/testing_table.json @@ -83,5 +83,6 @@ "title": "protoapp", "lib_paths": [ "test31/lib" ] }, + { "module_root": "test32", "modules": ["test32a", "test32b"], "fail": true, "title": "Circular module reference"}, { "module_root": "demo1", "modules": ["picture" ] } ] diff --git a/rust/compiler/src/processing/resolver.rs b/rust/compiler/src/processing/resolver.rs index d878c5a1..ff478403 100644 --- a/rust/compiler/src/processing/resolver.rs +++ b/rust/compiler/src/processing/resolver.rs @@ -82,7 +82,7 @@ impl Resolver { let module_refs = find_module_refs(&module0); for m in &module_refs { - self.add_module(m)?; + self.add_module_impl(in_progress, m)?; } let type_params = HashSet::new();