@@ -56,35 +56,35 @@ impl<'a> InterfaceChecker<'a> {
56
56
Ok ( self )
57
57
}
58
58
59
- fn check_member ( & self , member : & str , module_path : & str ) -> InterfaceCheckResult {
59
+ fn check_member (
60
+ & self ,
61
+ member : & str ,
62
+ definition_module : & str ,
63
+ usage_module : & str ,
64
+ ) -> InterfaceCheckResult {
60
65
if member. is_empty ( ) {
61
66
return InterfaceCheckResult :: TopLevelModule ;
62
67
}
63
68
64
- let matching_interfaces = self . interfaces . get_interfaces ( module_path ) ;
69
+ let matching_interfaces = self . interfaces . get_interfaces ( definition_module ) ;
65
70
66
71
if matching_interfaces. is_empty ( ) {
67
72
return InterfaceCheckResult :: NoInterfaces ;
68
73
}
69
74
70
- let mut is_exposed = false ;
71
75
for interface in matching_interfaces {
72
- if interface. expose . iter ( ) . any ( |re| re. is_match ( member) ) {
73
- is_exposed = true ;
76
+ if interface. is_exposed_to ( member, usage_module) {
77
+ return InterfaceCheckResult :: Exposed {
78
+ type_check_result : self
79
+ . type_check_cache
80
+ . as_ref ( )
81
+ . map ( |cache| cache. get_result ( member) )
82
+ . unwrap_or ( TypeCheckResult :: Unknown ) ,
83
+ } ;
74
84
}
75
85
}
76
86
77
- if !is_exposed {
78
- return InterfaceCheckResult :: NotExposed ;
79
- }
80
-
81
- InterfaceCheckResult :: Exposed {
82
- type_check_result : self
83
- . type_check_cache
84
- . as_ref ( )
85
- . map ( |cache| cache. get_result ( member) )
86
- . unwrap_or ( TypeCheckResult :: Unknown ) ,
87
- }
87
+ InterfaceCheckResult :: NotExposed
88
88
}
89
89
90
90
fn check_interfaces (
@@ -113,7 +113,11 @@ impl<'a> InterfaceChecker<'a> {
113
113
. strip_prefix ( & dependency_module_config. path )
114
114
. and_then ( |s| s. strip_prefix ( '.' ) )
115
115
. unwrap_or ( "" ) ;
116
- let check_result = self . check_member ( import_member, & dependency_module_config. path ) ;
116
+ let check_result = self . check_member (
117
+ import_member,
118
+ & dependency_module_config. path ,
119
+ & file_module. module_config ( ) . path ,
120
+ ) ;
117
121
match check_result {
118
122
InterfaceCheckResult :: NotExposed => Ok ( vec ! [ Diagnostic :: new_located_error(
119
123
file_module. relative_file_path( ) . to_path_buf( ) ,
0 commit comments