File tree 3 files changed +30
-8
lines changed
using_trait_on_trait_func
3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ fn ensure_satisfies_trait_func(
138
138
trait_func : & TraitFunc ,
139
139
impl_func : & Func ,
140
140
) -> Result < ( ) , ResolveError > {
141
- let mut for_alls = ForAlls :: default ( ) ;
141
+ if !impl_func. impl_params . params . is_empty ( ) {
142
+ return Err ( ResolveError :: other (
143
+ "Implementation parameter is not allowed by trait definition" ,
144
+ impl_func. source ,
145
+ ) ) ;
146
+ }
142
147
148
+ let mut for_alls = ForAlls :: default ( ) ;
143
149
let mut mappings = HashMap :: new ( ) ;
144
150
for sub in expected. values ( ) {
145
151
collect_constraints_into ( & mut mappings, sub) ;
Original file line number Diff line number Diff line change
1
+
2
+ pragma => adept(c"3.0")
3
+
4
+ trait Speak<$T> {
5
+ func speak(self $T) void
6
+ }
7
+
8
+ trait Act {
9
+ func act() void
10
+ }
11
+
12
+ impl Act myExampleImpl {
13
+ #[using Speak<int>]
14
+ func act() {}
15
+ }
16
+
17
+ func main {}
18
+
Original file line number Diff line number Diff line change 1
1
2
2
pragma => adept(c"3.0")
3
3
4
- trait Example<$T> {
5
- #[using Speak<$T>]
6
- func invalidFunction(self $T) void
7
- }
8
-
9
4
trait Speak<$T> {
10
5
func speak(self $T) void
11
6
}
12
7
13
- func main {
14
-
8
+ trait InvalidTrait<$T> {
9
+ #[using Speak<$T>]
10
+ func invalidFunction(self $T) void
15
11
}
16
12
13
+ func main {}
14
+
You can’t perform that action at this time.
0 commit comments