Use disjunction to resolve main function
Use disjunction to resolve main function

Using `resolveValueMember` can result in the wrong, or unrelated main
functions being selected. If an error occurs while resolving, such as an
ambiguous resolution, the solution will contain everything called
'main'. During the resolution, the `BestOverload` will not be set, so
the code skips down to iterating over the member decls and selecting the
first declaration that is a `MainTypeMainMethod`.

The order of candidates in the failure state is related to the order
that the declarations appear in source. The selected and potentially
unrelated main function is called from `$main`. The call in the
expression will then detect the invalid state later.

When only a single main function could exist in a given context, this
was not a problem. Any other possible solutions would result in an
error, either due to a duplicate declaration, or from calling an
unrelated function. When we introduced the asynchronous main function,
the resolution can be ambiguous because we allow asynchronous overloads
of synchronous functions. This enables us to legally write

```
struct MainType {
  static func main() { }
  static func main() async { }
}
```

From the perspective of duplicate declarations, this is not an issue. It
is, however, ambiguous since we have no calling context with which to
break the tie.

In the original code, this example would select the synchronous main
function because it comes first in the source. If we flip the
declarations, the asynchronous main function is selected because it
comes first in the source.

Instead, using the constraint solver to solve for the correct overload
will ensure that we only get back a valid main function. If the
constraint solver reports no solutions or many solutions, we can emit an
error immediately, as it will not consider unrelated functions.

JGiola/swift,JGiola/swift,JGiola/swift,apple/swift,ahoppen/swift,atrick/swift,atrick/swift,roambotics/swift,ahoppen/swift,ahoppen/swift,JGiola/swift,ahoppen/swift,apple/swift,benlangmuir/swift,benlangmuir/swift,benlangmuir/swift,atrick/swift,apple/swift,ahoppen/swift,atrick/swift,roambotics/swift,glessard/swift,benlangmuir/swift,glessard/swift,apple/swift,atrick/swift,JGiola/swift,roambotics/swift,glessard/swift,apple/swift,JGiola/swift,roambotics/swift,benlangmuir/swift,glessard/swift,benlangmuir/swift,atrick/swift,roambotics/swift,ahoppen/swift,glessard/swift,roambotics/swift,apple/swift,glessard/swift