Allow implicit discard when right-hand side is Void.
This is the most intuitive/expected behavior. Otherwise, it forces a pointless let-binding to 'Void' or into a discard.
This commit is contained in:
@@ -93,6 +93,19 @@ fn validator_illegal_return_type() {
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn implicitly_discard_void() {
|
||||
let source_code = r#"
|
||||
pub fn label(str: String) -> Void {
|
||||
trace str Void
|
||||
}
|
||||
"#;
|
||||
|
||||
let (warnings, _) = check_validator(parse(source_code)).expect("should type-check");
|
||||
|
||||
assert!(warnings.is_empty(), "no warnings: {warnings:#?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validator_illegal_arity() {
|
||||
let source_code = r#"
|
||||
|
||||
Reference in New Issue
Block a user