Commit 8dfce14
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 7c65ed2 commit 8dfce14
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3380 | 3380 | | |
3381 | 3381 | | |
3382 | 3382 | | |
3383 | | - | |
| 3383 | + | |
| 3384 | + | |
3384 | 3385 | | |
3385 | 3386 | | |
3386 | 3387 | | |
| |||
0 commit comments