@@ -162,16 +162,7 @@ impl Environment<'_> {
162162 // Process scope
163163 let result = process_scope ( self , problems) ;
164164
165- // We only check for unused entities if the scope was successfully
166- // processed. If it was not then any seemingly unused entities may have
167- // been used beyond the point where the error occurred, so we don't want
168- // to incorrectly warn about them.
169- let usage_tracking = if result. is_ok ( ) {
170- UsageTracking :: TrackUnused
171- } else {
172- UsageTracking :: IgnoreUnused
173- } ;
174- self . close_scope ( initial, usage_tracking, problems) ;
165+ self . close_scope ( initial, result. is_ok ( ) , problems) ;
175166
176167 // Return result of typing the scope
177168 result
@@ -186,15 +177,19 @@ impl Environment<'_> {
186177 pub fn close_scope (
187178 & mut self ,
188179 data : ScopeResetData ,
189- usage_tracking : UsageTracking ,
180+ was_successful : bool ,
190181 problems : & mut Problems ,
191182 ) {
192183 let unused = self
193184 . local_variable_usages
194185 . pop ( )
195186 . expect ( "There was no top entity scope." ) ;
196187
197- if let UsageTracking :: TrackUnused = usage_tracking {
188+ // We only check for unused entities if the scope was successfully
189+ // processed. If it was not then any seemingly unused entities may have
190+ // been used beyond the point where the error occurred, so we don't want
191+ // to incorrectly warn about them.
192+ if was_successful {
198193 self . handle_unused_variables ( unused, problems) ;
199194 }
200195 self . scope = data. local_values ;
@@ -794,12 +789,6 @@ pub enum Imported {
794789 Value ( EcoString ) ,
795790}
796791
797- #[ derive( Debug , Clone , Copy ) ]
798- pub enum UsageTracking {
799- TrackUnused ,
800- IgnoreUnused ,
801- }
802-
803792/// Unify two types that should be the same.
804793/// Any unbound type variables will be linked to the other type as they are the same.
805794///
0 commit comments