Skip to content

Commit a98cb0c

Browse files
committed
chore(pilota-build): add position info for default value type check error
1 parent 4bb3d1b commit a98cb0c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pilota-build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pilota-build"
3-
version = "0.13.2"
3+
version = "0.13.3"
44
edition.workspace = true
55
homepage.workspace = true
66
repository.workspace = true

pilota-build/src/middle/context.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,26 @@ impl Context {
14331433
assert!(l.is_empty());
14341434
("::std::collections::BTreeMap::new()".into(), false)
14351435
}
1436-
_ => panic!("unexpected literal {lit:?} with ty {ty:?}"),
1436+
_ => {
1437+
let (def_path, idl_file) = with_cur_item(|def_id| {
1438+
let def_path = self.item_path(def_id).iter().join("::");
1439+
let file_path = self
1440+
.db
1441+
.node(def_id)
1442+
.and_then(|node| {
1443+
self.db
1444+
.file_paths()
1445+
.get(&node.file_id)
1446+
.map(|path| path.display().to_string())
1447+
})
1448+
.unwrap_or_else(|| "<unknown>".to_string());
1449+
(def_path, file_path)
1450+
});
1451+
1452+
panic!(
1453+
"unexpected literal {lit:?} with ty {ty}, position: (def_path: {def_path} in idl_file: {idl_file})"
1454+
);
1455+
}
14371456
})
14381457
}
14391458

0 commit comments

Comments
 (0)