Skip to content

Commit

Permalink
add test for name resolution shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
tardyp committed Aug 27, 2024
1 parent ed27ba5 commit 4eb65a0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions prost-reflect/tests/data/name_resolution4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
file:
- name: dep.proto
package: foo.bar
messageType:
- name: FooBar
- name: root.proto
package: com.foo.bar
dependency:
- dep.proto
messageType:
- name: Foo
field:
- name: foobar
number: 1
label: LABEL_OPTIONAL
typeName: foo.FooBar
jsonName: foobar
syntax: proto3
1 change: 1 addition & 0 deletions prost-reflect/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ check_err!(invalid_service_type3);
check_err!(name_resolution1);
check_err!(name_resolution2);
check_ok!(name_resolution3);
check_err!(name_resolution4);
check_err!(name_collision1);
check_err!(name_collision2);
check_err!(name_collision3);
Expand Down
11 changes: 11 additions & 0 deletions prost-reflect/tests/snapshots/main__name_resolution4.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
source: prost-reflect/tests/main.rs
assertion_line: 79
expression: actual
---
causes: []
help: "'foo.FooBar' is is resolved to 'com.foo.FooBar', which is not defined. The innermost scope is searched first in name resolution. Consider using a leading '.'(i.e., '.foo.FooBar') to start from the outermost scope."
labels: []
message: "name 'foo.FooBar' is shadowed"
related: []
severity: error

0 comments on commit 4eb65a0

Please sign in to comment.