Skip to content

Commit 55c3cb6

Browse files
committed
try fix merge_def_type stackoverflow
1 parent 7c56f6d commit 55c3cb6

File tree

10 files changed

+23
-20
lines changed

10 files changed

+23
-20
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ members = [
77

88
[workspace.dependencies]
99
# local
10-
emmylua_code_analysis = { path = "crates/emmylua_code_analysis", version = "0.10.0" }
11-
emmylua_parser = { path = "crates/emmylua_parser", version = "0.12.0" }
12-
emmylua_parser_desc = { path = "crates/emmylua_parser_desc", version = "0.12.0" }
10+
emmylua_code_analysis = { path = "crates/emmylua_code_analysis", version = "0.11.0" }
11+
emmylua_parser = { path = "crates/emmylua_parser", version = "0.13.0" }
12+
emmylua_parser_desc = { path = "crates/emmylua_parser_desc", version = "0.13.0" }
1313
emmylua_diagnostic_macro = { path = "crates/emmylua_diagnostic_macro", version = "0.5.0" }
1414

1515
# external

crates/emmylua_check/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_check"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
edition = "2024"
55
authors = ["CppCXY"]
66
description = "A command-line tool for checking lua code."

crates/emmylua_code_analysis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_code_analysis"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
edition = "2024"
55
authors = ["CppCXY"]
66
description = "A library for analyzing lua code."

crates/emmylua_code_analysis/resources/std/os.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function os.exit(code) end
138138
--- Returns the value of the process environment variable `varname`, or
139139
--- **nil** if the variable is not defined.
140140
---@param varname string
141-
---@return string
141+
---@return string?
142142
function os.getenv(varname) end
143143

144144
---

crates/emmylua_code_analysis/src/compilation/analyzer/bind_type/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod migrate_global_member;
2-
32
use migrate_global_member::migrate_global_members_when_type_resolve;
43
use rowan::TextRange;
54

@@ -49,21 +48,25 @@ pub fn bind_type(
4948
migrate_global_members_when_type_resolve(db, type_owner);
5049
} else {
5150
let decl_type = decl_type_cache?.as_type();
52-
merge_def_type(db, decl_type.clone(), type_cache.as_type().clone());
51+
merge_def_type(db, decl_type.clone(), type_cache.as_type().clone(), 0);
5352
}
5453

5554
Some(())
5655
}
5756

58-
fn merge_def_type(db: &mut DbIndex, decl_type: LuaType, expr_type: LuaType) {
57+
fn merge_def_type(db: &mut DbIndex, decl_type: LuaType, expr_type: LuaType, merge_level: i32) {
58+
if merge_level > 1 {
59+
return;
60+
}
61+
5962
match &decl_type {
6063
LuaType::Def(def) => match &expr_type {
6164
LuaType::TableConst(in_filed_range) => {
6265
merge_def_type_with_table(db, def.clone(), in_filed_range.clone());
6366
}
6467
LuaType::Instance(instance) => {
6568
let base_ref = instance.get_base();
66-
merge_def_type(db, base_ref.clone(), expr_type);
69+
merge_def_type(db, base_ref.clone(), expr_type, merge_level + 1);
6770
}
6871
_ => {}
6972
},

crates/emmylua_doc_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_doc_cli"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
edition = "2024"
55
authors = ["CppCXY"]
66
description = "A command-line tool for generating lua documentation."

crates/emmylua_ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_ls"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
edition = "2024"
55
authors = ["CppCXY"]
66
description = "A language server for emmylua."

crates/emmylua_parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_parser"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
edition = "2024"
55
authors = ["CppCXY"]
66
description = "A parser for EmmyLua and luals"

crates/emmylua_parser_desc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_parser_desc"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
edition = "2024"
55
authors = ["CppCXY", "taminomara"]
66
description = "A parser for markup within Lua comments"

0 commit comments

Comments
 (0)