-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
crates/test-files/fixtures/ingots/trait_ingot_check/src/foo.fe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub struct MyS { | ||
fn x() -> u256 { | ||
return 10 | ||
} | ||
} | ||
|
||
pub trait Trait { | ||
fn x() -> u256; | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/test-files/fixtures/ingots/trait_ingot_check/src/main.fe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use foo::{MyS, Trait} | ||
|
||
impl Trait for MyS { | ||
fn x() -> u256 { | ||
return 10 | ||
} | ||
} | ||
|
||
contract Foo { | ||
pub fn main() -> u256 { | ||
return MyS::x() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Fixed broken trait orphan rule | ||
|
||
Fe has an orphan rule for Traits similar to Rust's that requires | ||
that either the trait or the type that we are implementing the trait for | ||
are located in the same ingot as the `impl`. This rule was implemented | ||
incorrectly so that instead of requiring them to be in the same ingot, | ||
they were required to be in the same module. This change fixes this | ||
so that the orphan rule is enforced correctly. |