Commit d203856
committed
Allow checking for invalid @main
Changing the overload resolution behavior results in the ordering that
`main` and `$main` are typechecked. If there is an error in parsing or
sema before we have typechecked these two functions, we get weird errors
about `$main` calling the main-actor `main` function being invalid. This
is because we have already set the `@main` attribute to invalid, so we
don't recognize the `$main` context as being a main entrypoint. The
error message compounds to making a confusing situation worse given that
`$main` is implicit. So by ignoring the failed `@main` attribute, we
still annotate the `$main` and `main` function as being on the main
actor, so everyone is happy in that respect.
To get the nasty behavior, you can forget to pass `-parse-as-library`
with this commit removed.1 parent 1b419c9 commit d203856
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3695 | 3695 | | |
3696 | 3696 | | |
3697 | 3697 | | |
3698 | | - | |
| 3698 | + | |
| 3699 | + | |
3699 | 3700 | | |
3700 | 3701 | | |
3701 | 3702 | | |
| |||
0 commit comments