Skip to content

Commit

Permalink
Check for errors after type checking type arguments. (FuelLabs#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha authored Dec 10, 2022
1 parent 71a33f9 commit 15991fb
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sway-core/src/type_system/type_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ impl TypeBinding<CallPath> {
);
}

if !errors.is_empty() {
return err(warnings, errors);
}

// monomorphize the declaration, if needed
let new_decl = match unknown_decl {
ty::TyDeclaration::FunctionDeclaration(original_id) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[package]]
name = 'core'
source = 'path+from-root-DC44092249FC5867'

[[package]]
name = 'insufficient_type_info_fnret'
source = 'member'
dependencies = ['std']

[[package]]
name = 'std'
source = 'path+from-root-DC44092249FC5867'
dependencies = ['core']
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "insufficient_type_info_fnret"

[dependencies]
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
script;

fn main() {
let b = foo::<Option>();
}

fn foo<T>() -> T {
let x = 1;
asm(x: x) {
x: T
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
category = "fail"

# check: let b = foo::<Option>();
# nextln: $()"Option" needs type arguments

0 comments on commit 15991fb

Please sign in to comment.