mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Narrowly disable tryOptimizeGenericDisjunction when some of the arguments are number literals
Don't attempt this optimization if call has number literals.
This is intended to narrowly fix situations like:
```swift
func test<T: FloatingPoint>(_: T) { ... }
func test<T: Numeric>(_: T) { ... }
test(42)
```
The call should use `<T: Numeric>` overload even though the
`<T: FloatingPoint>` is a more specialized version because
selecting `<T: Numeric>` doesn't introduce non-default literal
types.
This commit is contained in:
@@ -497,6 +497,10 @@ public:
|
||||
/// literal (represented by `ArrayExpr` and `DictionaryExpr` in AST).
|
||||
bool isCollectionLiteralType() const;
|
||||
|
||||
/// Determine whether this type variable represents a literal such
|
||||
/// as an integer value, a floating-point value with and without a sign.
|
||||
bool isNumberLiteralType() const;
|
||||
|
||||
/// Determine whether this type variable represents a result type of a
|
||||
/// function call.
|
||||
bool isFunctionResult() const;
|
||||
|
||||
Reference in New Issue
Block a user