@@ -2370,20 +2370,22 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
2370
2370
}
2371
2371
2372
2372
ClauseGuard :: FieldAccess {
2373
- location ,
2373
+ label_location ,
2374
2374
label,
2375
2375
container,
2376
2376
index : _,
2377
2377
type_ : ( ) ,
2378
2378
} => match self . infer_clause_guard ( * container. clone ( ) ) {
2379
- Ok ( container) => self . infer_guard_record_access ( container, label, location ) ,
2379
+ Ok ( container) => self . infer_guard_record_access ( container, label, label_location ) ,
2380
2380
2381
2381
Err ( err) => match * container {
2382
2382
ClauseGuard :: Var { name, location, .. } => {
2383
- self . infer_guard_module_access ( name, label, location, err)
2383
+ self . infer_guard_module_access ( name, label, location, label_location , err)
2384
2384
}
2385
2385
2386
- _ => Err ( Error :: RecordAccessUnknownType { location } ) ,
2386
+ _ => Err ( Error :: RecordAccessUnknownType {
2387
+ location : label_location,
2388
+ } ) ,
2387
2389
} ,
2388
2390
} ,
2389
2391
@@ -2820,7 +2822,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
2820
2822
container,
2821
2823
label,
2822
2824
index : Some ( index) ,
2823
- location,
2825
+ label_location : location,
2824
2826
type_,
2825
2827
} )
2826
2828
}
@@ -2829,11 +2831,12 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
2829
2831
& mut self ,
2830
2832
name : EcoString ,
2831
2833
label : EcoString ,
2832
- location : SrcSpan ,
2834
+ module_location : SrcSpan ,
2835
+ label_location : SrcSpan ,
2833
2836
record_access_error : Error ,
2834
2837
) -> Result < TypedClauseGuard , Error > {
2835
2838
let module_access = self
2836
- . infer_module_access ( & name, label, & location , location )
2839
+ . infer_module_access ( & name, label, & module_location , label_location )
2837
2840
. and_then ( |ma| match ma {
2838
2841
TypedExpr :: ModuleSelect {
2839
2842
location,
@@ -2849,7 +2852,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
2849
2852
module_name. clone ( ) ,
2850
2853
label. clone ( ) ,
2851
2854
& label,
2852
- location ,
2855
+ label_location ,
2853
2856
ReferenceKind :: Qualified ,
2854
2857
) ;
2855
2858
@@ -2866,7 +2869,9 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
2866
2869
_ => Err ( Error :: RecordAccessUnknownType { location } ) ,
2867
2870
} ,
2868
2871
2869
- _ => Err ( Error :: RecordAccessUnknownType { location } ) ,
2872
+ _ => Err ( Error :: RecordAccessUnknownType {
2873
+ location : module_location,
2874
+ } ) ,
2870
2875
} ) ;
2871
2876
2872
2877
// If the name is in the environment, use the original error from
0 commit comments