Fix module-scoped type definitions that conflict with existing global ones

This commit is contained in:
Tim Wojtulewicz 2022-08-08 15:30:34 -07:00
parent cb3abccfb1
commit 514df9f179
3 changed files with 24 additions and 1 deletions

View file

@ -1323,7 +1323,7 @@ decl:
std::unique_ptr<std::vector<AttrPtr>>($11)); std::unique_ptr<std::vector<AttrPtr>>($11));
} }
| TOK_TYPE global_id ':' | TOK_TYPE def_global_id ':'
{ cur_decl_type_id = $2; zeekygen_mgr->StartType({NewRef{}, $2}); } { cur_decl_type_id = $2; zeekygen_mgr->StartType({NewRef{}, $2}); }
type opt_attr ';' type opt_attr ';'
{ {

View file

@ -0,0 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
[a=5]
[b=6]

View file

@ -0,0 +1,20 @@
# @TEST-EXEC: zeek -b %INPUT > out
# @TEST-EXEC: btest-diff out
type r: record { a: count; };
module test;
type r: record { b: count; };
event zeek_init()
{
local x: GLOBAL::r;
x$a = 5;
local y: test::r;
y$b = 6;
print(x);
print(y);
}