FuelLabs / FuelLabs/sway

Non user friendly error reporting when constructing a tuple using function syntax

Open
#7,465 0 comments 0 reactions 1 assignee Claimed by @tritao View on GitHub
bug triage
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

### Related Component

compiler

### Problem

```rust
contract;

pub type MyU64 = u64;
pub type MyTuple = (MyU64, MyU64);

abi MyContract {
fn with_mytuple() -> MyTuple;
}

impl MyContract for Contract {
fn with_mytuple() -> MyTuple {
MyTuple(32, 64)
}
}
```

```
Compiling library std (registry+std?0.70.1#QmU7w9Aqa6jvQcj72HS8uqfFk3ieiC74WsZGaRfUrW1u41!)
Compiling contract contract_with_alias (/home/joao/dev/fuels-rs/e2e/sway/abi/contract_with_alias)
warning
--> /home/joao/dev/fuels-rs/e2e/sway/abi/contract_with_alias/src/main.sw:15:18
|
13 |
14 | impl MyContract for Contract {
15 | fn with_b256(b: b256) -> b256 {
| - This declaration is never used.
16 | b256::zero()
17 | }
|
____

error
--> /home/joao/dev/fuels-rs/e2e/sway/abi/contract_with_alias/src/main.sw:5:10
|
3 | pub type MyAlias = Vec;
4 | pub type MyU64 = u64;
5 | pub type MyTuple = (MyU64, MyU64);
| ^^^^^^^ This is a type alias, not a function.
6 | pub type MyArray = [MyTuple; 2];
7 |
|
____

Aborting due to 1 error.
error: Failed to compile contract_with_alias
```

### Steps

.

### Possible Solution(s)

_No response_

### Notes

_No response_

### Installed components

```console
.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.