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