@@ -10,6 +10,7 @@ use emmylua_parser::{LuaAstNode, LuaClosureExpr, LuaExpr, LuaLiteralExpr, LuaLit
1010use infer_binary:: infer_binary_expr;
1111use infer_call:: infer_call_expr;
1212pub use infer_call:: instantiate_doc_function;
13+ use infer_config:: ExprCache ;
1314pub use infer_config:: LuaInferConfig ;
1415use infer_index:: infer_index_expr;
1516use infer_name:: infer_name_expr;
@@ -25,8 +26,10 @@ pub type InferResult = Option<LuaType>;
2526
2627pub fn infer_expr ( db : & DbIndex , config : & mut LuaInferConfig , expr : LuaExpr ) -> InferResult {
2728 let syntax_id = expr. get_syntax_id ( ) ;
28- if let Some ( result) = config. get_cache_expr_type ( & syntax_id) {
29- return Some ( result. clone ( ) ) ;
29+ match config. get_cache_expr_type ( & syntax_id) {
30+ Some ( ExprCache :: Cache ( ty) ) => return Some ( ty. clone ( ) ) ,
31+ Some ( ExprCache :: ReadyCache ) => return Some ( LuaType :: Unknown ) ,
32+ None => { }
3033 }
3134
3235 // for @as
@@ -37,6 +40,7 @@ pub fn infer_expr(db: &DbIndex, config: &mut LuaInferConfig, expr: LuaExpr) -> I
3740 return Some ( force_type. clone ( ) ) ;
3841 }
3942
43+ config. mark_ready_cache ( syntax_id) ;
4044 let result_type = match expr {
4145 LuaExpr :: CallExpr ( call_expr) => infer_call_expr ( db, config, call_expr) ?,
4246 LuaExpr :: TableExpr ( table_expr) => infer_table_expr ( db, config, table_expr) ?,
0 commit comments