-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for mismatched sort generics in conv
- Loading branch information
1 parent
d036ff2
commit 8b96f46
Showing
3 changed files
with
68 additions
and
5 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
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
54 changes: 54 additions & 0 deletions
54
tests/tests/neg/error_messages/conv/mismatched_generics.rs
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,54 @@ | ||
use flux_rs::*; | ||
|
||
#[refined_by(n: int)] | ||
struct S { | ||
#[field(i32[n])] | ||
f: i32, | ||
} | ||
|
||
defs! { | ||
fn foo(s: S<int>) -> int { //~ Error sorts associated with this struct should have no generic arguments but 1 generic argument supplied | ||
s.n | ||
} | ||
|
||
fn foo2(x: int<bool>) -> int { //~ Error primitive sort int expects no generics but found 1 | ||
1 | ||
} | ||
|
||
fn foo3(x: Map<int>) -> int { //~ Error primitive sort Map expects exactly 2 generic arguments but found 1 | ||
1 | ||
} | ||
|
||
fn foo4(x: Map) -> int { //~ Error primitive sort Map expects exactly 2 generic arguments but found 0 | ||
1 | ||
} | ||
|
||
fn foo5(x: Set<int, int>) -> int { //~ Error primitive sort Set expects exactly one generic argument but found 2 | ||
1 | ||
} | ||
|
||
fn foo6(x: real<bool>) -> real { //~ Error primitive sort real expects no generics but found 1 | ||
1 | ||
} | ||
|
||
fn foo7(x: bool<int>) -> real { //~ Error primitive sort bool expects no generics but found 1 | ||
1 | ||
} | ||
} | ||
|
||
#[flux::refined_by(f: T<int>)] //~ Error type parameter expects no generics but found 1 | ||
struct X<T> { | ||
#[flux::field(T[f])] | ||
f: T | ||
} | ||
|
||
#[flux::assoc(fn foo(x: Self<int>) -> int)] //~ Error type parameter expects no generics but found 1 | ||
trait MyTrait {} | ||
|
||
flux_rs::defs! { | ||
opaque sort MyOpaqueSort; | ||
} | ||
|
||
#[flux_rs::opaque] | ||
#[flux_rs::refined_by(f: MyOpaqueSort<int>)] //~ Error type parameter expects no generics but found 1 | ||
struct Y {} |