[CSOptimizer] Infer argument candidates from calls to Double and CGFloat constructors

Helps situations like `1 + {Double, CGFloat}(...)` by inferring
a type for the second operand of `+` based on a type being constructed.

Currently limited to Double and CGFloat only since we need to
support implicit `Double<->CGFloat` conversion.

Helps situations like `1 + CGFloat(...)` by inferring a type for
the second operand of `+` based on a type being constructed.
Currently limited to known integer, floating-point and CGFloat types
since we know how they are structured.
This commit is contained in:
Pavel Yaskevich
2024-09-19 17:44:06 -07:00
parent 59109c2d60
commit f2a6677a6d
4 changed files with 44 additions and 0 deletions

View File

@@ -497,6 +497,10 @@ public:
/// literal (represented by `ArrayExpr` and `DictionaryExpr` in AST).
bool isCollectionLiteralType() const;
/// Determine whether this type variable represents a result type of a
/// function call.
bool isFunctionResult() const;
/// Retrieve the representative of the equivalence class to which this
/// type variable belongs.
///