Reverts apple/swift#30006. It caused a regression that we'd like to address before re-landing:
```swift
struct X {
var cgf: CGFloat
}
func test(x: X?) {
let _ = (x?.cgf ?? 0) <= 0.5
}
```
This reverts commit 0a6b444b49.
This reverts commit ed255596a6.
This reverts commit 3e01160a2f.
This reverts commit 96297b7e39.
Resolves: rdar://problem/60185506
If none of the candidates produce expected contextual type, record
all of the posibilities to produce a note per and diagnose this as
contextual type mismatch instead of a reference ambiguity.
This either became dead shortly after the removal of Swift 3
compatibility mode from the constraint solver, or even earlier.
Note that the code completion test change is actually correct
because (Any) -> () is not convertible to () -> () in the
language.
This builds on initial commit which added `RelabelArguments` fix
to the solver that only supported `missingLabels` at that moment,
but now it supports all three posibilities - missing/extraneous and
incorrect labels.
These had previously been removed in
9c2bc50acd because of differences in the
diagnostics being emitted across different platforms.
It looks like we're always emitting the same diagnostic now, so restore
a specific message.
Resolves: rdar://problem/19677545
as a failure to convert the individual operand, since the operator
is likely conceptually generic in some way and the choice of any
specific overload is probably arbitrary.
Since we now fall back to a better-informed diagnostics point, take
advantage of this to generate a specialized diagnostic when trying to
compare values of function type with ===.
Fixes rdar://25666129.
This reverts commit 073f427942,
i.e. it reapplies 35ba809fd0 with a
test fix to expect an extra note in one place.
These APIs are from the Swift 1.2 => Swift 2.0 transition, and are not
relevant anymore.
Removing them reduces the surface area of the library that needs to be
reviewed.
1. We have complex logic in stdlib/public/core/FixedPoint.swift.gyb that emits
or hides certain initializers on integer types based on the bit width
combination. We check that those APIs are indeed present or absent in cases we
expect.
All of [U]Int{8,16,32,64,} initializers, labelled and unlabelled.
(swift) UInt16(-10 as Int32)
<REPL Input>:1:1: error: integer overflows when converted from 'Int32' to 'UInt16'
UInt16(-10 as Int32)
(swift) UInt16(truncatingBitPattern: -10 as Int32)
// r3 : UInt16 = 65526
(swift) UInt16(truncatingBitPattern: -10 as Int16)
<REPL Input>:1:1: error: cannot invoke initializer for type 'UInt16' with an argument list of type '(truncatingBitPattern: Int16)'
UInt16(truncatingBitPattern: -10 as Int16)
<REPL Input>:1:1: note: overloads for 'UInt16' exist with these partially matching parameter lists: (Int16), (bitPattern: Int16)
A slight change in the type combination dramatically changes the available
overload set. You can’t check this with one or two tests and be confident that
every source/destination combination is correct.
2. We check that the APIs above are present or absent regardless of the target
platform so that the code is portable (for example, because Int64 -> Int is a
truncating operation on at least one platform, the corresponding “truncating”
initializer is available for portability on 64-bit platforms, even though it is
not actually truncating there.)
3. We rely on ambiguity in the overload set of “+“ and “-“ for certain
combinations of arguments to disallow mixed-sign arithmetic. Again, these
ambiguities rely on a tricky combination of protocols, associated types, the
way those associated types are defined by our integer types, and overload
resolution rules in the type checker.
4. The test also checks migration facilities for Word and UWord.
Swift SVN r30655
These types are leftovers from the early pre-1.0 times when Int and UInt
were always 64-bit on all platforms. They serve no useful purpose
today. Int and UInt are defined to be word-sized and should be used
instead.
rdar://18693488
Swift SVN r30564
expressions. Broadening from callexpr to apply expr (picking up operators) improves
several diagnostics in the testsuite, and is important to avoid regressions from an
upcoming patch.
Swift SVN r29821
lvalues when compiling list of partial-match overloads in diagnosis.
(This is a reapplication of commits r29462 and r29469.)
Also, fix the following tests:
stdlib/FixedPointDiagnostics.swift.gyb
stdlib/NumericDiagnostics.swift.gyb
<rdar://problem/17875634> can't append to array of tuples
Swift SVN r29493
The protocol is still needed in order to make sure mixed signed/unsigned
arithmetic doesn't compile, but after pulling all its "real"
requirements into UnsignedIntegerType, that's now its only function.
Thus, rename it to _DisallowMixedSignArithmetic.
Swift SVN r28980