Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[package]]
name = "core"
source = "path+from-root-DFCFC85C94C0C9BD"

[[package]]
name = "std"
source = "path+from-root-DFCFC85C94C0C9BD"
dependencies = ["core"]

[[package]]
name = "unify_never"
source = "member"
dependencies = ["std"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[project]
authors = ["Fuel Labs <contact@fuel.sh>"]
license = "Apache-2.0"
name = "unify_never"
entry = "main.sw"

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

// Test of unification of the Never type

impl [u32;0] {
fn foo(self){
log("32");
}
}

impl [!;0] {
fn foo(self){
log("never");
}
}

fn main() {
let z:[u32;0] = [];

// Should fail because z gets the type of its type ascription
let y: [!;0] = z;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
category = "fail"

#check: $()error
#check: $()Mismatched types
#nextln: $()expected: [!; 0]
#nextln: $()found: [u32; 0].
#nextln: $()help: Variable declaration's type annotation does not match up with the assigned expression's type

#check: $()Aborting due to 1 error
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@ fn test_2(){
}


fn main() {
impl [u32;0] {
fn foo(self) -> u64 {
32
}
}

impl [!;0] {
fn foo(self) -> u64{
64
}
}

fn main() -> u64 {
test_1();
test_2();

let x:[u32;0] = [];
x.foo() // should return 32
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
category = "compile"
category = "run"
expected_warnings = 1
expected_result = { action = "return", value = 32 }
expected_result_new_encoding = { action = "return_data", value = "0000000000000020" }
validate_abi = false
Loading