forked from M-Labs/nac3
1
0
Fork 0

nac3core: fix #45 toplevel better error msg for methods/functions

This commit is contained in:
ychenfo 2021-10-03 17:22:06 +08:00
parent f5ce1afe0b
commit 24b2111c64
1 changed files with 10 additions and 4 deletions

View File

@ -894,9 +894,11 @@ impl TopLevelComposer {
.node
.annotation
.as_ref()
.ok_or_else(|| {
"function parameter type annotation needed".to_string()
})?
.ok_or_else(|| format!(
"function parameter `{}` at {} need type annotation",
x.node.arg,
x.location
))?
.as_ref();
let type_annotation = parse_ast_to_type_annotation_kinds(
@ -1098,7 +1100,11 @@ impl TopLevelComposer {
.node
.annotation
.as_ref()
.ok_or_else(|| "type annotation needed".to_string())?
.ok_or_else(|| format!(
"type annotation for `{}` at {} needed",
x.node.arg,
x.location
))?
.as_ref();
parse_ast_to_type_annotation_kinds(
class_resolver.as_ref(),