Skip to content

Commit c1b39c9

Browse files
committed
---
yaml --- r: 294591 b: refs/heads/tensorflow c: eeeb469 h: refs/heads/master i: 294589: 1200c2b 294587: 2a6ef93 294583: bdbfc42 294575: 3d2bd53 294559: 61919ad 294527: 5e63973
1 parent 5d93e87 commit c1b39c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+453
-867
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 8e5c027a776a5b9f3b69226f6580752b7171bf1d
819+
refs/heads/tensorflow: eeeb46956f52d2000e4a5cfbc98d5f7a31e5edef
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ endif()
117117

118118
set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
119119
"Build Swift with code coverage instrumenting enabled [FALSE, NOT-MERGED, MERGED]")
120+
set_property(CACHE SWIFT_ANALYZE_CODE_COVERAGE PROPERTY
121+
STRINGS FALSE "NOT-MERGED" "MERGED")
120122

121123
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
122124
# can be reused when a new version of Swift comes out (assuming the user hasn't
@@ -169,6 +171,8 @@ endif()
169171

170172
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
171173
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
174+
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
175+
STRINGS "Debug" "RelWithDebInfo" "Release" "MinSizeRel")
172176
# Allow the user to specify the standard library CMAKE_MSVC_RUNTIME_LIBRARY
173177
# value. The following values are valid:
174178
# - MultiThreaded (/MT)

branches/tensorflow/cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,20 +1914,6 @@ function(add_swift_target_library name)
19141914
GYB_SOURCES ${SWIFTLIB_GYB_SOURCES}
19151915
)
19161916

1917-
if(sdk STREQUAL WINDOWS)
1918-
if(SWIFT_COMPILER_IS_MSVC_LIKE)
1919-
if (SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebugDLL)
1920-
target_compile_options(${VARIANT_NAME} PRIVATE /MDd /D_DLL /D_DEBUG)
1921-
elseif (SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebug)
1922-
target_compile_options(${VARIANT_NAME} PRIVATE /MTd /U_DLL /D_DEBUG)
1923-
elseif (SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDLL)
1924-
target_compile_options(${VARIANT_NAME} PRIVATE /MD /D_DLL /U_DEBUG)
1925-
elseif (SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY MATCHES MultiThreaded)
1926-
target_compile_options(${VARIANT_NAME} PRIVATE /MT /U_DLL /U_DEBUG)
1927-
endif()
1928-
endif()
1929-
endif()
1930-
19311917
if(NOT SWIFTLIB_OBJECT_LIBRARY)
19321918
# Add dependencies on the (not-yet-created) custom lipo target.
19331919
foreach(DEP ${SWIFTLIB_LINK_LIBRARIES})

branches/tensorflow/cmake/modules/StandaloneOverlay.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
6565
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
6666
"Build type for the Swift standard library and SDK overlays.")
6767

68+
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
69+
STRINGS
70+
"Debug" "RelWithDebInfo" "Release" "MinSizeRel")
71+
6872
# -----------------------------------------------------------------------------
6973
# Constants
7074

branches/tensorflow/include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ ERROR(cannot_convert_sequence_element_value,none,
452452
"cannot convert sequence element type %0 to expected type %1",
453453
(Type, Type))
454454
ERROR(cannot_convert_sequence_element_protocol,none,
455-
"sequence element type %0 does not conform to expected protocol %1",
455+
"sequence element type %0 does not conform to expected type %1",
456456
(Type, Type))
457457

458458
ERROR(throws_functiontype_mismatch,none,

branches/tensorflow/lib/AST/ASTContext.cpp

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,50 +3440,13 @@ DependentMemberType *DependentMemberType::get(Type base,
34403440

34413441
OpaqueTypeArchetypeType *
34423442
OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
3443-
SubstitutionMap Substitutions) {
3443+
SubstitutionMap Substitutions)
3444+
{
34443445
// TODO: We could attempt to preserve type sugar in the substitution map.
3446+
// Currently archetypes are assumed to be always canonical in many places,
3447+
// though, so doing so would require fixing those places.
34453448
Substitutions = Substitutions.getCanonical();
3446-
3447-
// TODO: Eventually an opaque archetype ought to be arbitrarily substitutable
3448-
// into any generic environment. However, there isn't currently a good way to
3449-
// do this with GenericSignatureBuilder; in a situation like this:
3450-
//
3451-
// __opaque_type Foo<t_0_0: P>: Q // internal signature <t_0_0: P, t_1_0: Q>
3452-
//
3453-
// func bar<t_0_0, t_0_1, t_0_2: P>() -> Foo<t_0_2>
3454-
//
3455-
// we'd want to feed the GSB constraints to form:
3456-
//
3457-
// <t_0_0: P, t_1_0: Q where t_0_0 == t_0_2>
3458-
//
3459-
// even though t_0_2 isn't *in* this generic signature; it represents a type
3460-
// bound elsewhere from some other generic context. If we knew the generic
3461-
// environment `t_0_2` came from, then maybe we could map it into that context,
3462-
// but currently we have no way to know that with certainty.
3463-
//
3464-
// For now, opaque types cannot propagate across decls; every declaration
3465-
// with an opaque type has a unique opaque decl. Therefore, the only
3466-
// expressions involving opaque types ought to be contextualized inside
3467-
// function bodies, and the only time we need an opaque interface type should
3468-
// be for the opaque decl itself and the originating decl with the opaque
3469-
// result type, in which case the interface type mapping is identity and
3470-
// this problem can be temporarily avoided.
3471-
#ifndef NDEBUG
3472-
for (unsigned i : indices(Substitutions.getReplacementTypes())) {
3473-
auto replacement = Substitutions.getReplacementTypes()[i];
3474-
3475-
if (!replacement->hasTypeParameter())
3476-
continue;
3477-
3478-
auto replacementParam = replacement->getAs<GenericTypeParamType>();
3479-
if (!replacementParam)
3480-
llvm_unreachable("opaque types cannot currently be parameterized by non-identity type parameter mappings");
3481-
3482-
assert(i == Decl->getGenericSignature()->getGenericParamOrdinal(replacementParam)
3483-
&& "opaque types cannot currently be parameterized by non-identity type parameter mappings");
3484-
}
3485-
#endif
3486-
3449+
34873450
llvm::FoldingSetNodeID id;
34883451
Profile(id, Decl, Substitutions);
34893452

@@ -3517,7 +3480,34 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
35173480
// decl have all been same-type-bound to the arguments from our substitution
35183481
// map.
35193482
GenericSignatureBuilder builder(ctx);
3483+
35203484
builder.addGenericSignature(Decl->getOpaqueInterfaceGenericSignature());
3485+
// TODO: The proper thing to do to build the environment in which the opaque
3486+
// type's archetype exists would be to take the generic signature of the
3487+
// decl, feed it into a GenericSignatureBuilder, then add same-type
3488+
// constraints into the builder to bind the outer generic parameters
3489+
// to their substituted types provided by \c Substitutions. However,
3490+
// this is problematic for interface types. In a situation like this:
3491+
//
3492+
// __opaque_type Foo<t_0_0: P>: Q // internal signature <t_0_0: P, t_1_0: Q>
3493+
//
3494+
// func bar<t_0_0, t_0_1, t_0_2: P>() -> Foo<t_0_2>
3495+
//
3496+
// we'd want to feed the GSB constraints to form:
3497+
//
3498+
// <t_0_0: P, t_1_0: Q where t_0_0 == t_0_2>
3499+
//
3500+
// even though t_0_2 isn't *in* the generic signature being built; it
3501+
// represents a type
3502+
// bound elsewhere from some other generic context. If we knew the generic
3503+
// environment `t_0_2` came from, then maybe we could map it into that context,
3504+
// but currently we have no way to know that with certainty.
3505+
//
3506+
// Because opaque types are currently limited so that they only have immediate
3507+
// protocol constraints, and therefore don't interact with the outer generic
3508+
// parameters at all, we can get away without adding these constraints for now.
3509+
// Adding where clauses would break this hack.
3510+
#if DO_IT_CORRECTLY
35213511
// Same-type-constrain the arguments in the outer signature to their
35223512
// replacements in the substitution map.
35233513
if (auto outerSig = Decl->getGenericSignature()) {
@@ -3529,7 +3519,24 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
35293519
[](Type, Type) { llvm_unreachable("error?"); });
35303520
}
35313521
}
3532-
3522+
#else
3523+
// Assert that there are no same type constraints on the underlying type.
3524+
// or its associated types.
3525+
//
3526+
// This should not be possible until we add where clause support.
3527+
# ifndef NDEBUG
3528+
for (auto reqt :
3529+
Decl->getOpaqueInterfaceGenericSignature()->getRequirements()) {
3530+
auto reqtBase = reqt.getFirstType()->getRootGenericParam();
3531+
if (reqtBase->isEqual(Decl->getUnderlyingInterfaceType())) {
3532+
assert(reqt.getKind() != RequirementKind::SameType
3533+
&& "supporting where clauses on opaque types requires correctly "
3534+
"setting up the generic environment for "
3535+
"OpaqueTypeArchetypeTypes; see comment above");
3536+
}
3537+
}
3538+
# endif
3539+
#endif
35333540
auto signature = std::move(builder)
35343541
.computeGenericSignature(SourceLoc());
35353542

branches/tensorflow/lib/AST/Type.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,11 +2932,8 @@ static Type getMemberForBaseType(LookupConformanceFn lookupConformances,
29322932
}
29332933

29342934
// If the parent is a type variable or a member rooted in a type variable,
2935-
// or if the parent is a type parameter, we're done. Also handle
2936-
// UnresolvedType here, which can come up in diagnostics.
2937-
if (substBase->isTypeVariableOrMember() ||
2938-
substBase->isTypeParameter() ||
2939-
substBase->is<UnresolvedType>())
2935+
// we're done.
2936+
if (substBase->isTypeVariableOrMember())
29402937
return getDependentMemberType(substBase);
29412938

29422939
// Retrieve the member type with the given name.
@@ -2945,6 +2942,10 @@ static Type getMemberForBaseType(LookupConformanceFn lookupConformances,
29452942
if (substBase->is<TupleType>())
29462943
return failed();
29472944

2945+
// If the parent is dependent, create a dependent member type.
2946+
if (substBase->isTypeParameter())
2947+
return getDependentMemberType(substBase);
2948+
29482949
// If we know the associated type, look in the witness table.
29492950
LazyResolver *resolver = substBase->getASTContext().getLazyResolver();
29502951
if (assocType) {

branches/tensorflow/lib/IDE/CodeCompletion.cpp

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,14 +2286,15 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
22862286
Builder.addRightParen();
22872287
}
22882288

2289-
SemanticContextKind getSemanticContextKind(const ValueDecl *VD) {
2289+
SemanticContextKind getSemanticContextKind(const AbstractFunctionDecl *AFD) {
22902290
// FIXME: to get the corect semantic context we need to know how lookup
2291-
// would have found the VD. For now, just infer a reasonable semantics.
2291+
// would have found the declaration AFD. For now, just infer a reasonable
2292+
// semantics.
22922293

2293-
if (!VD)
2294+
if (!AFD)
22942295
return SemanticContextKind::CurrentModule;
22952296

2296-
DeclContext *calleeDC = VD->getDeclContext();
2297+
DeclContext *calleeDC = AFD->getDeclContext();
22972298

22982299
if (calleeDC->isTypeContext())
22992300
// FIXME: We should distinguish CurrentNominal and Super. We need to
@@ -2308,37 +2309,6 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
23082309
return SemanticContextKind::OtherModule;
23092310
}
23102311

2311-
void addSubscriptCallPattern(const AnyFunctionType *AFT,
2312-
const SubscriptDecl *SD) {
2313-
foundFunction(AFT);
2314-
auto genericSig =
2315-
SD->getInnermostDeclContext()->getGenericSignatureOfContext();
2316-
AFT = eraseArchetypes(CurrDeclContext->getParentModule(),
2317-
const_cast<AnyFunctionType *>(AFT), genericSig)
2318-
->castTo<AnyFunctionType>();
2319-
2320-
CommandWordsPairs Pairs;
2321-
CodeCompletionResultBuilder Builder(
2322-
Sink, CodeCompletionResult::ResultKind::Declaration,
2323-
getSemanticContextKind(SD), expectedTypeContext);
2324-
Builder.setAssociatedDecl(SD);
2325-
setClangDeclKeywords(SD, Pairs, Builder);
2326-
if (!HaveLParen)
2327-
Builder.addLeftBracket();
2328-
else
2329-
Builder.addAnnotatedLeftBracket();
2330-
addCallArgumentPatterns(Builder, AFT, SD->getIndices());
2331-
if (!HaveLParen)
2332-
Builder.addRightBracket();
2333-
else
2334-
Builder.addAnnotatedRightBracket();
2335-
if (SD && SD->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>())
2336-
addTypeAnnotationForImplicitlyUnwrappedOptional(Builder,
2337-
AFT->getResult());
2338-
else
2339-
addTypeAnnotation(Builder, AFT->getResult());
2340-
}
2341-
23422312
void addFunctionCallPattern(const AnyFunctionType *AFT,
23432313
const AbstractFunctionDecl *AFD = nullptr) {
23442314
if (AFD) {
@@ -2358,15 +2328,14 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
23582328
AFD ? CodeCompletionResult::ResultKind::Declaration
23592329
: CodeCompletionResult::ResultKind::Pattern,
23602330
getSemanticContextKind(AFD), expectedTypeContext);
2361-
if (AFD) {
2362-
Builder.setAssociatedDecl(AFD);
2363-
setClangDeclKeywords(AFD, Pairs, Builder);
2364-
}
2365-
23662331
if (!HaveLParen)
23672332
Builder.addLeftParen();
23682333
else
23692334
Builder.addAnnotatedLeftParen();
2335+
if (AFD) {
2336+
Builder.setAssociatedDecl(AFD);
2337+
setClangDeclKeywords(AFD, Pairs, Builder);
2338+
}
23702339

23712340
addCallArgumentPatterns(Builder, AFT->getParams(), declParams,
23722341
includeDefaultArgs);
@@ -5394,15 +5363,9 @@ void CodeCompletionCallbacksImpl::doneParsing() {
53945363
if (ShouldCompleteCallPatternAfterParen &&
53955364
!ContextInfo.getPossibleCallees().empty()) {
53965365
Lookup.setHaveLParen(true);
5397-
for (auto &typeAndDecl : ContextInfo.getPossibleCallees()) {
5398-
if (auto SD = dyn_cast_or_null<SubscriptDecl>(typeAndDecl.second)) {
5399-
Lookup.addSubscriptCallPattern(typeAndDecl.first, SD);
5400-
} else {
5401-
Lookup.addFunctionCallPattern(
5402-
typeAndDecl.first,
5403-
dyn_cast_or_null<AbstractFunctionDecl>(typeAndDecl.second));
5404-
}
5405-
}
5366+
for (auto &typeAndDecl : ContextInfo.getPossibleCallees())
5367+
Lookup.tryFunctionCallCompletions(typeAndDecl.first,
5368+
typeAndDecl.second);
54065369
Lookup.setHaveLParen(false);
54075370

54085371
shouldPerformGlobalCompletion =

branches/tensorflow/lib/IDE/CodeCompletionResultBuilder.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,11 @@ class CodeCompletionResultBuilder {
217217
CodeCompletionString::Chunk::ChunkKind::RightParen, ")");
218218
}
219219

220-
void addAnnotatedLeftBracket() {
221-
addLeftBracket();
222-
getLastChunk().setIsAnnotation();
223-
}
224-
225220
void addLeftBracket() {
226221
addChunkWithTextNoCopy(
227222
CodeCompletionString::Chunk::ChunkKind::LeftBracket, "[");
228223
}
229224

230-
void addAnnotatedRightBracket() {
231-
addRightBracket();
232-
getLastChunk().setIsAnnotation();
233-
}
234-
235225
void addRightBracket() {
236226
addChunkWithTextNoCopy(
237227
CodeCompletionString::Chunk::ChunkKind::RightBracket, "]");

branches/tensorflow/lib/IDE/ExprContextAnalysis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ static bool collectPossibleCalleesForSubscript(
404404
if (subscriptExpr->hasDecl()) {
405405
if (auto SD = dyn_cast<SubscriptDecl>(subscriptExpr->getDecl().getDecl())) {
406406
auto declType = SD->getInterfaceType();
407-
declType = declType.subst(subscriptExpr->getDecl().getSubstitutions());
408407
if (auto *funcType = declType->getAs<AnyFunctionType>())
409408
candidates.emplace_back(funcType, SD);
410409
}

branches/tensorflow/lib/Parse/ParseExpr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,9 +925,12 @@ ParserResult<Expr> Parser::parseExprSuper(bool isExprBasic) {
925925
rSquareLoc,
926926
trailingClosure,
927927
SyntaxKind::FunctionCallArgumentList);
928+
if (status.hasCodeCompletion())
929+
return makeParserCodeCompletionResult<Expr>();
930+
if (status.isError())
931+
return nullptr;
928932
SyntaxContext->createNodeInPlace(SyntaxKind::SubscriptExpr);
929933
return makeParserResult(
930-
status,
931934
SubscriptExpr::create(Context, superRef, lSquareLoc, indexArgs,
932935
indexArgLabels, indexArgLabelLocs, rSquareLoc,
933936
trailingClosure, ConcreteDeclRef(),

branches/tensorflow/lib/SIL/TypeLowering.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "swift/AST/DiagnosticsSIL.h"
2020
#include "swift/AST/Expr.h"
2121
#include "swift/AST/GenericEnvironment.h"
22-
#include "swift/AST/LazyResolver.h"
2322
#include "swift/AST/Module.h"
2423
#include "swift/AST/NameLookup.h"
2524
#include "swift/AST/Pattern.h"
@@ -1901,10 +1900,6 @@ TypeConverter::getFunctionInterfaceTypeWithCaptures(CanAnyFunctionType funcType,
19011900
CanAnyFunctionType TypeConverter::makeConstantInterfaceType(SILDeclRef c) {
19021901
auto *vd = c.loc.dyn_cast<ValueDecl *>();
19031902

1904-
if (vd && !vd->hasInterfaceType()) {
1905-
Context.getLazyResolver()->resolveDeclSignature(vd);
1906-
}
1907-
19081903
switch (c.kind) {
19091904
case SILDeclRef::Kind::Func: {
19101905
if (auto *ACE = c.loc.dyn_cast<AbstractClosureExpr *>()) {

branches/tensorflow/lib/SILGen/ManagedValue.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ void ManagedValue::copyInto(SILGenFunction &SGF, SILLocation loc,
6969
lowering.emitStoreOfCopy(SGF.B, loc, copy, dest, IsInitialization);
7070
}
7171

72-
void ManagedValue::copyInto(SILGenFunction &SGF, SILLocation loc,
73-
Initialization *dest) {
74-
dest->copyOrInitValueInto(SGF, loc, *this, /*isInit*/ false);
75-
dest->finishInitialization(SGF);
76-
}
77-
7872
/// This is the same operation as 'copy', but works on +0 values that don't
7973
/// have cleanups. It returns a +1 value with one.
8074
ManagedValue ManagedValue::copyUnmanaged(SILGenFunction &SGF, SILLocation loc) {

branches/tensorflow/lib/SILGen/ManagedValue.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,6 @@ class ManagedValue {
334334
/// uninitialized address.
335335
void copyInto(SILGenFunction &SGF, SILLocation loc, SILValue dest);
336336

337-
/// Store a copy of this value with independent ownership into the given
338-
/// initialization \p dest.
339-
void copyInto(SILGenFunction &SGF, SILLocation loc, Initialization *dest);
340-
341337
explicit operator bool() const {
342338
// "InContext" is not considered false.
343339
return bool(getValue()) || valueAndFlag.getInt();

0 commit comments

Comments
 (0)