mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Fix module-scoped type definitions that conflict with existing global ones
This commit is contained in:
parent
cb3abccfb1
commit
514df9f179
3 changed files with 24 additions and 1 deletions
|
@ -1323,7 +1323,7 @@ decl:
|
|||
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}); }
|
||||
type opt_attr ';'
|
||||
{
|
||||
|
|
3
testing/btest/Baseline/language.global-type-clash/out
Normal file
3
testing/btest/Baseline/language.global-type-clash/out
Normal 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]
|
20
testing/btest/language/global-type-clash.zeek
Normal file
20
testing/btest/language/global-type-clash.zeek
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue