@@ -668,7 +668,8 @@ namespace {
668
668
opaqueType = LValueType::get (opaqueType);
669
669
670
670
ASTContext &ctx = tc.Context ;
671
- auto archetypeVal = new (ctx) OpaqueValueExpr (base->getLoc (), opaqueType);
671
+ auto archetypeVal =
672
+ new (ctx) OpaqueValueExpr (base->getSourceRange (), opaqueType);
672
673
cs.cacheType (archetypeVal);
673
674
674
675
// Record the opened existential.
@@ -2169,8 +2170,8 @@ namespace {
2169
2170
2170
2171
// This OpaqueValueExpr represents the result of builderInit above in
2171
2172
// silgen.
2172
- OpaqueValueExpr *interpolationExpr =
2173
- new (tc. Context ) OpaqueValueExpr (expr->getLoc (), interpolationType);
2173
+ OpaqueValueExpr *interpolationExpr = new (tc. Context )
2174
+ OpaqueValueExpr (expr->getSourceRange (), interpolationType);
2174
2175
cs.setType (interpolationExpr, interpolationType);
2175
2176
expr->setInterpolationExpr (interpolationExpr);
2176
2177
@@ -5046,8 +5047,8 @@ Expr *ExprRewriter::coerceTupleToTuple(Expr *expr,
5046
5047
SmallVector<OpaqueValueExpr *, 4 > destructured;
5047
5048
for (unsigned i = 0 , e = sources.size (); i != e; ++i) {
5048
5049
auto fromEltType = fromTuple->getElementType (i);
5049
- auto *opaqueElt = new (tc. Context ) OpaqueValueExpr (expr-> getLoc (),
5050
- fromEltType);
5050
+ auto *opaqueElt =
5051
+ new (tc. Context ) OpaqueValueExpr (expr-> getSourceRange (), fromEltType);
5051
5052
cs.cacheType (opaqueElt);
5052
5053
destructured.push_back (opaqueElt);
5053
5054
}
@@ -5141,10 +5142,8 @@ Expr *ExprRewriter::coerceSuperclass(Expr *expr, Type toType,
5141
5142
// concrete superclass.
5142
5143
auto fromArchetype = OpenedArchetypeType::getAny (fromType);
5143
5144
5144
- auto *archetypeVal =
5145
- cs.cacheType (
5146
- new (tc.Context ) OpaqueValueExpr (expr->getLoc (),
5147
- fromArchetype));
5145
+ auto *archetypeVal = cs.cacheType (new (tc.Context ) OpaqueValueExpr (
5146
+ expr->getSourceRange (), fromArchetype));
5148
5147
5149
5148
auto *result = coerceSuperclass (archetypeVal, toType, locator);
5150
5149
@@ -5207,12 +5206,10 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
5207
5206
// For existential-to-existential coercions, open the source existential.
5208
5207
if (fromType->isAnyExistentialType ()) {
5209
5208
fromType = OpenedArchetypeType::getAny (fromType);
5210
-
5211
- auto *archetypeVal =
5212
- cs.cacheType (
5213
- new (ctx) OpaqueValueExpr (expr->getLoc (),
5214
- fromType));
5215
-
5209
+
5210
+ auto *archetypeVal = cs.cacheType (
5211
+ new (ctx) OpaqueValueExpr (expr->getSourceRange (), fromType));
5212
+
5216
5213
auto *result = cs.cacheType (ErasureExpr::create (ctx, archetypeVal, toType,
5217
5214
conformances));
5218
5215
return cs.cacheType (
@@ -5897,10 +5894,8 @@ maybeDiagnoseUnsupportedFunctionConversion(ConstraintSystem &cs, Expr *expr,
5897
5894
5898
5895
// / Build the conversion of an element in a collection upcast.
5899
5896
static Expr *buildElementConversion (ExprRewriter &rewriter,
5900
- SourceLoc srcLoc,
5901
- Type srcType,
5902
- Type destType,
5903
- bool bridged,
5897
+ SourceRange srcRange, Type srcType,
5898
+ Type destType, bool bridged,
5904
5899
ConstraintLocatorBuilder locator,
5905
5900
Expr *element) {
5906
5901
auto &cs = rewriter.getConstraintSystem ();
@@ -5920,12 +5915,9 @@ static Expr *buildElementConversion(ExprRewriter &rewriter,
5920
5915
}
5921
5916
5922
5917
static CollectionUpcastConversionExpr::ConversionPair
5923
- buildOpaqueElementConversion (ExprRewriter &rewriter,
5924
- SourceLoc srcLoc,
5925
- Type srcCollectionType,
5926
- Type destCollectionType,
5927
- bool bridged,
5928
- ConstraintLocatorBuilder locator,
5918
+ buildOpaqueElementConversion (ExprRewriter &rewriter, SourceRange srcRange,
5919
+ Type srcCollectionType, Type destCollectionType,
5920
+ bool bridged, ConstraintLocatorBuilder locator,
5929
5921
unsigned typeArgIndex) {
5930
5922
// We don't need this stuff unless we've got generalized casts.
5931
5923
Type srcType = srcCollectionType->castTo <BoundGenericType>()
@@ -5937,14 +5929,13 @@ buildOpaqueElementConversion(ExprRewriter &rewriter,
5937
5929
auto &cs = rewriter.getConstraintSystem ();
5938
5930
ASTContext &ctx = cs.getASTContext ();
5939
5931
auto opaque =
5940
- rewriter.cs .cacheType (new (ctx) OpaqueValueExpr (srcLoc , srcType));
5932
+ rewriter.cs .cacheType (new (ctx) OpaqueValueExpr (srcRange , srcType));
5941
5933
5942
- Expr *conversion =
5943
- buildElementConversion (rewriter, srcLoc, srcType, destType, bridged,
5944
- locator.withPathElement (
5945
- ConstraintLocator::PathElement::getGenericArgument (
5946
- typeArgIndex)),
5947
- opaque);
5934
+ Expr *conversion = buildElementConversion (
5935
+ rewriter, srcRange, srcType, destType, bridged,
5936
+ locator.withPathElement (
5937
+ ConstraintLocator::PathElement::getGenericArgument (typeArgIndex)),
5938
+ opaque);
5948
5939
5949
5940
return { opaque, conversion };
5950
5941
}
@@ -6999,9 +6990,9 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
6999
6990
bodyFnTy->withExtInfo (bodyFnTy->getExtInfo ().withNoEscape ()));
7000
6991
body = coerceToType (body, bodyFnTy, locator);
7001
6992
assert (body && " can't make nonescaping?!" );
7002
-
6993
+
7003
6994
auto escapable = new (tc.Context )
7004
- OpaqueValueExpr (apply->getFn ()->getLoc (), Type ());
6995
+ OpaqueValueExpr (apply->getFn ()->getSourceRange (), Type ());
7005
6996
cs.setType (escapable, escapableParams[0 ].getOldType ());
7006
6997
7007
6998
auto getType = [&](const Expr *E) -> Type {
@@ -7058,8 +7049,8 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
7058
7049
->getOpenedExistentialType ()
7059
7050
->isEqual (existentialInstanceTy));
7060
7051
7061
- auto opaqueValue = new (tc. Context )
7062
- OpaqueValueExpr (apply->getLoc (), openedTy);
7052
+ auto opaqueValue =
7053
+ new (tc. Context ) OpaqueValueExpr (apply->getSourceRange (), openedTy);
7063
7054
cs.setType (opaqueValue, openedTy);
7064
7055
7065
7056
auto getType = [&](const Expr *E) -> Type {
0 commit comments