forked from M-Labs/nac3
1
0
Fork 0

improve error messages

This commit is contained in:
Sebastien Bourdeauducq 2020-03-28 15:12:12 +08:00
parent f9a56c7d8f
commit 69ed23ee00
1 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,7 @@ impl<'ctx> CodeGen<'ctx> {
return Err(self.compile_error(CompileErrorKind::Unsupported("custom decorators"))) return Err(self.compile_error(CompileErrorKind::Unsupported("custom decorators")))
} }
} else { } else {
return Err(self.compile_error(CompileErrorKind::Unsupported("complex decorators"))) return Err(self.compile_error(CompileErrorKind::Unsupported("decorator must be an identifier")))
} }
} }
@ -122,7 +122,7 @@ impl<'ctx> CodeGen<'ctx> {
if let ast::ExpressionType::Identifier { name } = &annotation.node { if let ast::ExpressionType::Identifier { name } = &annotation.node {
Ok(self.get_basic_type(&name)?) Ok(self.get_basic_type(&name)?)
} else { } else {
Err(self.compile_error(CompileErrorKind::Unsupported("complex type annotation"))) Err(self.compile_error(CompileErrorKind::Unsupported("type annotation must be an identifier")))
} }
} else { } else {
Err(self.compile_error(CompileErrorKind::MissingTypeAnnotation)) Err(self.compile_error(CompileErrorKind::MissingTypeAnnotation))
@ -133,7 +133,7 @@ impl<'ctx> CodeGen<'ctx> {
if let ast::ExpressionType::Identifier { name } = &returns.node { if let ast::ExpressionType::Identifier { name } = &returns.node {
if name == "None" { None } else { Some(self.get_basic_type(name)?) } if name == "None" { None } else { Some(self.get_basic_type(name)?) }
} else { } else {
return Err(self.compile_error(CompileErrorKind::Unsupported("complex type annotation"))) return Err(self.compile_error(CompileErrorKind::Unsupported("type annotation must be an identifier")))
} }
} else { } else {
None None