Commit 50e1768
committed
Reject method declarations on interface types
Interfaces are abstract and cannot be receivers. The compiler was
silently accepting the declaration and storing the method as an
unreachable global — the runtime would never dispatch to it because
interface values are always their concrete underlying type.
Add a registry check in methodDecl that returns MethodOnInterface
before the function body is compiled.1 parent b17b19a commit 50e1768
3 files changed
Lines changed: 4 additions & 0 deletions
File tree
- examples/spec/fail
- src/lang
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
| 1069 | + | |
1069 | 1070 | | |
1070 | 1071 | | |
1071 | 1072 | | |
| |||
0 commit comments