@@ -17,9 +17,7 @@ pub fn check_generic_type_compact(
1717 check_guard : TypeCheckGuard ,
1818) -> TypeCheckResult {
1919 // 不检查尚未实例化的泛型类
20- if source_generic. contain_tpl ( ) {
21- return Ok ( ( ) ) ;
22- }
20+ let is_tpl = source_generic. contain_tpl ( ) ;
2321
2422 let source_base_id = source_generic. get_base_type_id ( ) ;
2523 let type_decl = db
@@ -41,24 +39,34 @@ pub fn check_generic_type_compact(
4139 }
4240
4341 match compact_type {
44- LuaType :: Generic ( compact_generic) => check_generic_type_compact_generic (
45- db,
46- source_generic,
47- compact_generic,
48- check_guard. next_level ( ) ?,
49- ) ,
42+ LuaType :: Generic ( compact_generic) => {
43+ if is_tpl {
44+ return Ok ( ( ) ) ;
45+ }
46+ check_generic_type_compact_generic (
47+ db,
48+ source_generic,
49+ compact_generic,
50+ check_guard. next_level ( ) ?,
51+ )
52+ }
5053 LuaType :: TableConst ( range) => check_generic_type_compact_table (
5154 db,
5255 source_generic,
5356 LuaMemberOwner :: Element ( range. clone ( ) ) ,
5457 check_guard. next_level ( ) ?,
5558 ) ,
56- LuaType :: Ref ( _) | LuaType :: Def ( _) => check_ref_type_compact (
57- db,
58- & source_generic. get_base_type_id ( ) ,
59- compact_type,
60- check_guard. next_level ( ) ?,
61- ) ,
59+ LuaType :: Ref ( _) | LuaType :: Def ( _) => {
60+ if is_tpl {
61+ return Ok ( ( ) ) ;
62+ }
63+ check_ref_type_compact (
64+ db,
65+ & source_generic. get_base_type_id ( ) ,
66+ compact_type,
67+ check_guard. next_level ( ) ?,
68+ )
69+ }
6270 _ => Err ( TypeCheckFailReason :: TypeNotMatch ) ,
6371 }
6472}
0 commit comments