Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error in struct instantiation #4689

Closed
esdrubal opened this issue Jun 20, 2023 · 0 comments · Fixed by #5910
Closed

Compile error in struct instantiation #4689

esdrubal opened this issue Jun 20, 2023 · 0 comments · Fixed by #5910
Assignees
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen

Comments

@esdrubal
Copy link
Contributor

The following script throws an error while compiling when ideally it shouldn't.

script;

trait Trait {
    fn method();
}

struct Struct<T> where T: Trait {
    
}

impl Trait for u64 {
    fn method() {}
}

const C: Struct<u64> = Struct{};

fn main() {}

The error is:

16 | const C: Struct<u64> = Struct{};
   |                        ^^^^^^^^ Trait "Trait" is not implemented for type "T".
@esdrubal esdrubal added bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Jun 20, 2023
@esdrubal esdrubal self-assigned this Jun 20, 2023
esdrubal added a commit that referenced this issue Apr 23, 2024
The issue reported in #4689 is already fixed.
This PR only adds a test to prove it works as expected.

Closes #4689.
IGI-111 pushed a commit that referenced this issue Apr 24, 2024
## Description

The issue reported in #4689 is already fixed.
This PR only adds a test to prove it works as expected.

Closes #4689.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant