@@ -1033,8 +1033,8 @@ namespace {
1033
1033
// I -> inout? O, where I and O are fresh type variables. The index
1034
1034
// expression must be convertible to I and the subscript expression
1035
1035
// itself has type inout? O, where O may or may not be an lvalue.
1036
- auto inputTv = CS.createTypeVariable (indexLocator, /* options */ 0 );
1037
-
1036
+ auto inputTv = CS.createTypeVariable (indexLocator);
1037
+
1038
1038
// For an integer subscript expression on an array slice type, instead of
1039
1039
// introducing a new type variable we can easily obtain the element type.
1040
1040
if (isa<SubscriptExpr>(anchor)) {
@@ -1419,7 +1419,7 @@ namespace {
1419
1419
1420
1420
auto memberLocator
1421
1421
= CS.getConstraintLocator (expr, ConstraintLocator::UnresolvedMember);
1422
- auto baseTy = CS.createTypeVariable (baseLocator, /* options */ 0 );
1422
+ auto baseTy = CS.createTypeVariable (baseLocator);
1423
1423
auto memberTy = CS.createTypeVariable (memberLocator, TVO_CanBindToLValue);
1424
1424
1425
1425
// An unresolved member expression '.member' is modeled as a value member
@@ -1440,8 +1440,7 @@ namespace {
1440
1440
// TODO: we definitely want this to include ImplicitlyUnwrappedOptional; does it
1441
1441
// need to include everything else in the world?
1442
1442
auto outputTy = CS.createTypeVariable (
1443
- CS.getConstraintLocator (expr, ConstraintLocator::FunctionResult),
1444
- /* options*/ 0 );
1443
+ CS.getConstraintLocator (expr, ConstraintLocator::FunctionResult));
1445
1444
CS.addConstraint (ConstraintKind::Conversion, outputTy, baseTy,
1446
1445
CS.getConstraintLocator (expr, ConstraintLocator::RvalueAdjustment));
1447
1446
@@ -1495,8 +1494,7 @@ namespace {
1495
1494
CS.getConstraintLocator (expr),
1496
1495
TVO_CanBindToLValue |
1497
1496
TVO_PrefersSubtypeBinding);
1498
- auto resultTy = CS.createTypeVariable (CS.getConstraintLocator (expr),
1499
- /* options*/ 0 );
1497
+ auto resultTy = CS.createTypeVariable (CS.getConstraintLocator (expr));
1500
1498
auto methodTy = FunctionType::get (argsTy, resultTy);
1501
1499
CS.addValueMemberConstraint (baseTy, expr->getName (),
1502
1500
methodTy, CurDC, expr->getFunctionRefKind (),
@@ -1972,8 +1970,7 @@ namespace {
1972
1970
return CS.getType (boundExpr)->getRValueType ();
1973
1971
}
1974
1972
1975
- return CS.createTypeVariable (CS.getConstraintLocator (locator),
1976
- /* options*/ 0 );
1973
+ return CS.createTypeVariable (CS.getConstraintLocator (locator));
1977
1974
}
1978
1975
1979
1976
case PatternKind::Named: {
@@ -2003,16 +2000,14 @@ namespace {
2003
2000
case ReferenceOwnership::Unmanaged:
2004
2001
if (ty)
2005
2002
return ty;
2006
- return CS.createTypeVariable (CS.getConstraintLocator (locator),
2007
- /* options*/ 0 );
2003
+ return CS.createTypeVariable (CS.getConstraintLocator (locator));
2008
2004
case ReferenceOwnership::Weak:
2009
2005
// For weak variables, use Optional<T>.
2010
2006
if (ty && ty->getOptionalObjectType ())
2011
2007
return ty; // Already Optional<T>.
2012
2008
// Create a fresh type variable to handle overloaded expressions.
2013
2009
if (!ty || ty->is <TypeVariableType>())
2014
- ty = CS.createTypeVariable (CS.getConstraintLocator (locator),
2015
- /* options*/ 0 );
2010
+ ty = CS.createTypeVariable (CS.getConstraintLocator (locator));
2016
2011
return CS.getTypeChecker ().getOptionalType (var->getLoc (), ty);
2017
2012
}
2018
2013
@@ -2052,8 +2047,7 @@ namespace {
2052
2047
#include " swift/AST/PatternNodes.def"
2053
2048
// TODO: we could try harder here, e.g. for enum elements to provide the
2054
2049
// enum type.
2055
- return CS.createTypeVariable (CS.getConstraintLocator (locator),
2056
- /* options*/ 0 );
2050
+ return CS.createTypeVariable (CS.getConstraintLocator (locator));
2057
2051
}
2058
2052
2059
2053
llvm_unreachable (" Unhandled pattern kind" );
@@ -2289,7 +2283,7 @@ namespace {
2289
2283
2290
2284
// If no return type was specified, create a fresh type
2291
2285
// variable for it.
2292
- funcTy = CS.createTypeVariable (locator, /* options */ 0 );
2286
+ funcTy = CS.createTypeVariable (locator);
2293
2287
2294
2288
// Allow it to default to () if there are no return statements.
2295
2289
if (closureHasNoResult (expr)) {
@@ -2326,8 +2320,7 @@ namespace {
2326
2320
// S < lvalue T
2327
2321
//
2328
2322
// where T is a fresh type variable.
2329
- auto lvalue = CS.createTypeVariable (CS.getConstraintLocator (expr),
2330
- /* options*/ 0 );
2323
+ auto lvalue = CS.createTypeVariable (CS.getConstraintLocator (expr));
2331
2324
auto bound = LValueType::get (lvalue);
2332
2325
auto result = InOutType::get (lvalue);
2333
2326
CS.addConstraint (ConstraintKind::Conversion,
@@ -2337,8 +2330,7 @@ namespace {
2337
2330
}
2338
2331
2339
2332
Type visitDynamicTypeExpr (DynamicTypeExpr *expr) {
2340
- auto tv = CS.createTypeVariable (CS.getConstraintLocator (expr),
2341
- /* options*/ 0 );
2333
+ auto tv = CS.createTypeVariable (CS.getConstraintLocator (expr));
2342
2334
CS.addConstraint (ConstraintKind::DynamicTypeOf, tv,
2343
2335
CS.getType (expr->getBase ()),
2344
2336
CS.getConstraintLocator (expr, ConstraintLocator::RvalueAdjustment));
@@ -2415,8 +2407,7 @@ namespace {
2415
2407
// variables T1 and T2.
2416
2408
if (outputTy.isNull ()) {
2417
2409
outputTy = CS.createTypeVariable (
2418
- CS.getConstraintLocator (expr, ConstraintLocator::FunctionResult),
2419
- /* options*/ 0 );
2410
+ CS.getConstraintLocator (expr, ConstraintLocator::FunctionResult));
2420
2411
} else {
2421
2412
// Since we know what the output type is, we can set it as the favored
2422
2413
// type of this expression.
@@ -2507,7 +2498,7 @@ namespace {
2507
2498
Type
2508
2499
createTypeVariableAndDisjunctionForIUOCoercion (Type toType,
2509
2500
ConstraintLocator *locator) {
2510
- auto typeVar = CS.createTypeVariable (locator, /* options= */ 0 );
2501
+ auto typeVar = CS.createTypeVariable (locator);
2511
2502
CS.buildDisjunctionForImplicitlyUnwrappedOptional (typeVar, toType,
2512
2503
locator);
2513
2504
return typeVar;
@@ -2643,7 +2634,7 @@ namespace {
2643
2634
2644
2635
Type visitDiscardAssignmentExpr (DiscardAssignmentExpr *expr) {
2645
2636
auto locator = CS.getConstraintLocator (expr);
2646
- auto typeVar = CS.createTypeVariable (locator, /* options= */ 0 );
2637
+ auto typeVar = CS.createTypeVariable (locator);
2647
2638
return LValueType::get (typeVar);
2648
2639
}
2649
2640
@@ -2658,8 +2649,7 @@ namespace {
2658
2649
if (!destTy)
2659
2650
return Type ();
2660
2651
if (destTy->is <UnresolvedType>()) {
2661
- return CS.createTypeVariable (CS.getConstraintLocator (expr),
2662
- /* options=*/ 0 );
2652
+ return CS.createTypeVariable (CS.getConstraintLocator (expr));
2663
2653
}
2664
2654
2665
2655
// The source must be convertible to the destination.
@@ -2774,7 +2764,7 @@ namespace {
2774
2764
auto &placeholderTy
2775
2765
= editorPlaceholderVariables[currentEditorPlaceholderVariable];
2776
2766
if (!placeholderTy) {
2777
- placeholderTy = CS.createTypeVariable (locator, /* options */ 0 );
2767
+ placeholderTy = CS.createTypeVariable (locator);
2778
2768
2779
2769
CS.addConstraint (ConstraintKind::Defaultable,
2780
2770
placeholderTy,
@@ -2830,8 +2820,8 @@ namespace {
2830
2820
// For native key paths, traverse the key path components to set up
2831
2821
// appropriate type relationships at each level.
2832
2822
auto locator = CS.getConstraintLocator (E);
2833
- Type root = CS.createTypeVariable (locator, /* options */ 0 );
2834
-
2823
+ Type root = CS.createTypeVariable (locator);
2824
+
2835
2825
// If a root type was explicitly given, then resolve it now.
2836
2826
if (auto rootRepr = E->getRootType ()) {
2837
2827
auto rootObjectTy = resolveTypeReferenceInExpression (rootRepr);
@@ -2893,7 +2883,7 @@ namespace {
2893
2883
2894
2884
// We can't assign an optional back through an optional chain
2895
2885
// today. Force the base to an rvalue.
2896
- auto rvalueTy = CS.createTypeVariable (locator, 0 );
2886
+ auto rvalueTy = CS.createTypeVariable (locator);
2897
2887
CS.addConstraint (ConstraintKind::Equal, base, rvalueTy, locator);
2898
2888
base = rvalueTy;
2899
2889
LLVM_FALLTHROUGH;
@@ -2921,14 +2911,14 @@ namespace {
2921
2911
// If there was an optional chaining component, the end result must be
2922
2912
// optional.
2923
2913
if (didOptionalChain) {
2924
- auto objTy = CS.createTypeVariable (locator, /* options */ 0 );
2914
+ auto objTy = CS.createTypeVariable (locator);
2925
2915
auto optTy = OptionalType::get (objTy);
2926
2916
CS.addConstraint (ConstraintKind::Conversion, base, optTy,
2927
2917
locator);
2928
2918
base = optTy;
2929
2919
}
2930
-
2931
- auto rvalueBase = CS.createTypeVariable (locator, /* options */ 0 );
2920
+
2921
+ auto rvalueBase = CS.createTypeVariable (locator);
2932
2922
CS.addConstraint (ConstraintKind::Equal, base, rvalueBase, locator);
2933
2923
2934
2924
// The result is a KeyPath from the root to the end component.
@@ -2939,8 +2929,7 @@ namespace {
2939
2929
} else {
2940
2930
// The type of key path depends on the overloads chosen for the key
2941
2931
// path components.
2942
- kpTy = CS.createTypeVariable (CS.getConstraintLocator (E),
2943
- /* options*/ 0 );
2932
+ kpTy = CS.createTypeVariable (CS.getConstraintLocator (E));
2944
2933
CS.addKeyPathConstraint (kpTy, root, rvalueBase,
2945
2934
CS.getConstraintLocator (E));
2946
2935
}
0 commit comments