Skip to content

Commit 2b5b90b

Browse files
committed
---
yaml --- r: 294654 b: refs/heads/tensorflow c: 1499811 h: refs/heads/master
1 parent c938e19 commit 2b5b90b

Some content is hidden

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

52 files changed

+206
-971
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: fe9b48c28d827afa9d6d7dbc39cc3d0b6d1f5004
819+
refs/heads/tensorflow: 1499811add498d18baf2faba6add19b72de19ca0
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/CHANGELOG.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29-
* [SR-8974][]:
30-
31-
Duplicate tuple element labels are no longer allowed, because it leads
32-
to incorrect behavior. For example:
33-
34-
```
35-
let dupLabels: (foo: Int, foo: Int) = (foo: 1, foo: 2)
36-
37-
enum Foo { case bar(x: Int, x: Int) }
38-
let f: Foo = .bar(x: 0, x: 1)
39-
```
40-
41-
will now be diagnosed as an error.
42-
43-
Note: You can still use duplicate labels when declaring functions and
44-
subscripts, as long as the internal labels are different. For example:
45-
46-
```
47-
func foo(bar x: Int, bar y: Int) {}
48-
subscript(a x: Int, a y: Int) -> Int {}
49-
```
50-
5129
* [SR-6118][]:
5230

5331
Subscripts can now declare default arguments:
@@ -7718,6 +7696,5 @@ Swift 1.0
77187696
[SR-7799]: <https://bugs.swift.org/browse/SR-7799>
77197697
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
77207698
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
7721-
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
77227699
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
77237700
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>

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/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,8 +3523,6 @@ ERROR(tuple_single_element,none,
35233523
"cannot create a single-element tuple with an element label", ())
35243524
ERROR(tuple_ellipsis,none,
35253525
"cannot create a variadic tuple", ())
3526-
ERROR(tuple_duplicate_label,none,
3527-
"cannot create a tuple with a duplicate element label", ())
35283526
ERROR(enum_element_ellipsis,none,
35293527
"variadic enum cases are not supported", ())
35303528

branches/tensorflow/include/swift/AST/Expr.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -953,25 +953,15 @@ class TapExpr : public Expr {
953953
class InterpolatedStringLiteralExpr : public LiteralExpr {
954954
/// Points at the beginning quote.
955955
SourceLoc Loc;
956-
/// Points at the ending quote.
957-
/// Needed for the upcoming \c ASTScope subsystem because lookups can be
958-
/// targeted to inside an \c InterpolatedStringLiteralExpr. It would be nicer
959-
/// to use \c EndLoc for this value, but then \c Lexer::getLocForEndOfToken()
960-
/// would not work for \c stringLiteral->getEndLoc().
961-
SourceLoc TrailingQuoteLoc;
962956
TapExpr *AppendingExpr;
963957
Expr *SemanticExpr;
964958

965959
public:
966-
InterpolatedStringLiteralExpr(SourceLoc Loc,
967-
SourceLoc TrailingQuoteLoc,
968-
unsigned LiteralCapacity,
960+
InterpolatedStringLiteralExpr(SourceLoc Loc, unsigned LiteralCapacity,
969961
unsigned InterpolationCount,
970962
TapExpr *AppendingExpr)
971963
: LiteralExpr(ExprKind::InterpolatedStringLiteral, /*Implicit=*/false),
972-
Loc(Loc),
973-
TrailingQuoteLoc(TrailingQuoteLoc),
974-
AppendingExpr(AppendingExpr), SemanticExpr() {
964+
Loc(Loc), AppendingExpr(AppendingExpr), SemanticExpr() {
975965
Bits.InterpolatedStringLiteralExpr.InterpolationCount = InterpolationCount;
976966
Bits.InterpolatedStringLiteralExpr.LiteralCapacity = LiteralCapacity;
977967
}
@@ -1008,11 +998,6 @@ class InterpolatedStringLiteralExpr : public LiteralExpr {
1008998
// token, so the range should be (Start == End).
1009999
return Loc;
10101000
}
1011-
SourceLoc getTrailingQuoteLoc() const {
1012-
// Except when computing a SourceRange for an ASTScope. Then the range
1013-
// must be (Start - TrainingQuoteLoc).
1014-
return TrailingQuoteLoc;
1015-
}
10161001

10171002
/// Call the \c callback with information about each segment in turn.
10181003
void forEachSegment(ASTContext &Ctx,

branches/tensorflow/include/swift/Serialization/ModuleFormat.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 493; // dependency types for structs
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 491; // mangled class names as vtable keys
5656

5757
using DeclIDField = BCFixed<31>;
5858

@@ -948,8 +948,7 @@ namespace decls_block {
948948
GenericEnvironmentIDField, // generic environment
949949
AccessLevelField, // access level
950950
BCVBR<4>, // number of conformances
951-
BCVBR<4>, // number of inherited types
952-
BCArray<TypeIDField> // inherited types, followed by dependency types
951+
BCArray<TypeIDField> // inherited types
953952
// Trailed by the generic parameters (if any), the members record, and
954953
// finally conformance info (if any).
955954
>;
@@ -982,8 +981,7 @@ namespace decls_block {
982981
TypeIDField, // superclass
983982
AccessLevelField, // access level
984983
BCVBR<4>, // number of conformances
985-
BCVBR<4>, // number of inherited types
986-
BCArray<TypeIDField> // inherited types, followed by dependency types
984+
BCArray<TypeIDField> // inherited types
987985
// Trailed by the generic parameters (if any), the members record, and
988986
// finally conformance info (if any).
989987
>;

branches/tensorflow/lib/AST/ASTContext.cpp

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

34413441
OpaqueTypeArchetypeType *
34423442
OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
3443-
SubstitutionMap Substitutions)
3444-
{
3443+
SubstitutionMap Substitutions) {
34453444
// 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.
34483445
Substitutions = Substitutions.getCanonical();
3449-
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+
34503487
llvm::FoldingSetNodeID id;
34513488
Profile(id, Decl, Substitutions);
34523489

@@ -3480,34 +3517,7 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
34803517
// decl have all been same-type-bound to the arguments from our substitution
34813518
// map.
34823519
GenericSignatureBuilder builder(ctx);
3483-
34843520
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
35113521
// Same-type-constrain the arguments in the outer signature to their
35123522
// replacements in the substitution map.
35133523
if (auto outerSig = Decl->getGenericSignature()) {
@@ -3519,24 +3529,7 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
35193529
[](Type, Type) { llvm_unreachable("error?"); });
35203530
}
35213531
}
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
3532+
35403533
auto signature = std::move(builder)
35413534
.computeGenericSignature(SourceLoc());
35423535

branches/tensorflow/lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,19 +1930,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
19301930
}
19311931
void visitInterpolatedStringLiteralExpr(InterpolatedStringLiteralExpr *E) {
19321932
printCommon(E, "interpolated_string_literal_expr");
1933-
1934-
// Print the trailing quote location
1935-
if (auto Ty = GetTypeOfExpr(E)) {
1936-
auto &Ctx = Ty->getASTContext();
1937-
auto TQL = E->getTrailingQuoteLoc();
1938-
if (TQL.isValid()) {
1939-
PrintWithColorRAII(OS, LocationColor) << " trailing_quote_loc=";
1940-
TQL.print(PrintWithColorRAII(OS, LocationColor).getOS(),
1941-
Ctx.SourceMgr);
1942-
}
1943-
}
1944-
PrintWithColorRAII(OS, LiteralValueColor)
1945-
<< " literal_capacity="
1933+
PrintWithColorRAII(OS, LiteralValueColor) << " literal_capacity="
19461934
<< E->getLiteralCapacity() << " interpolation_count="
19471935
<< E->getInterpolationCount() << '\n';
19481936
printRec(E->getAppendingExpr());

branches/tensorflow/lib/AST/Expr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ static LiteralExpr *
813813
shallowCloneImpl(const InterpolatedStringLiteralExpr *E, ASTContext &Ctx,
814814
llvm::function_ref<Type(const Expr *)> getType) {
815815
auto res = new (Ctx) InterpolatedStringLiteralExpr(E->getLoc(),
816-
E->getTrailingQuoteLoc(),
817816
E->getLiteralCapacity(),
818817
E->getInterpolationCount(),
819818
E->getAppendingExpr());

branches/tensorflow/lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,7 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
636636
invocationArgStrs.back().append(moduleCachePath);
637637
}
638638

639-
if (importerOpts.DisableModulesValidateSystemHeaders) {
640-
invocationArgStrs.push_back("-fno-modules-validate-system-headers");
641-
} else {
639+
if (!importerOpts.DisableModulesValidateSystemHeaders) {
642640
invocationArgStrs.push_back("-fmodules-validate-system-headers");
643641
}
644642

branches/tensorflow/lib/IDE/REPLCodeCompletion.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "swift/IDE/REPLCodeCompletion.h"
1818
#include "swift/AST/ASTContext.h"
19-
#include "swift/AST/DiagnosticSuppression.h"
2019
#include "swift/AST/Module.h"
2120
#include "swift/Basic/LLVM.h"
2221
#include "swift/Basic/SourceManager.h"
@@ -194,7 +193,7 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
194193
CodeCompletionCallbacksFactory *CompletionCallbacksFactory) {
195194
// Temporarily disable printing the diagnostics.
196195
ASTContext &Ctx = SF.getASTContext();
197-
DiagnosticSuppression SuppressedDiags(Ctx.Diags);
196+
DiagnosticTransaction DelayedDiags(Ctx.Diags);
198197

199198
std::string AugmentedCode = EnteredCode.str();
200199
AugmentedCode += '\0';
@@ -223,10 +222,7 @@ doCodeCompletion(SourceFile &SF, StringRef EnteredCode, unsigned *BufferID,
223222
// Now we are done with code completion. Remove the declarations we
224223
// temporarily inserted.
225224
SF.Decls.resize(OriginalDeclCount);
226-
227-
// Reset the error state because it's only relevant to the code that we just
228-
// processed, which now gets thrown away.
229-
Ctx.Diags.resetHadAnyError();
225+
DelayedDiags.abort();
230226
}
231227

232228
void REPLCompletions::populate(SourceFile &SF, StringRef EnteredCode) {

branches/tensorflow/lib/Parse/ParseExpr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,8 +2039,8 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
20392039
// Return an error, but include an empty InterpolatedStringLiteralExpr
20402040
// so that parseDeclPoundDiagnostic() can figure out why this string
20412041
// literal was bad.
2042-
return makeParserErrorResult(new (Context) InterpolatedStringLiteralExpr(
2043-
Loc, Loc.getAdvancedLoc(CloseQuoteBegin), 0, 0, nullptr));
2042+
return makeParserErrorResult(
2043+
new (Context) InterpolatedStringLiteralExpr(Loc, 0, 0, nullptr));
20442044
}
20452045

20462046
unsigned LiteralCapacity = 0;
@@ -2093,8 +2093,7 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
20932093
}
20942094

20952095
return makeParserResult(Status, new (Context) InterpolatedStringLiteralExpr(
2096-
Loc, Loc.getAdvancedLoc(CloseQuoteBegin),
2097-
LiteralCapacity, InterpolationCount,
2096+
Loc, LiteralCapacity, InterpolationCount,
20982097
AppendingExpr));
20992098
}
21002099

branches/tensorflow/lib/Parse/ParseIfConfig.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "swift/Parse/Parser.h"
1818

1919
#include "swift/AST/ASTVisitor.h"
20-
#include "swift/AST/DiagnosticSuppression.h"
2120
#include "swift/Basic/Defer.h"
2221
#include "swift/Basic/LangOptions.h"
2322
#include "swift/Basic/Version.h"
@@ -639,12 +638,6 @@ ParserResult<IfConfigDecl> Parser::parseIfConfig(
639638
SmallVector<ASTNode, 16> Elements;
640639
if (isActive || !isVersionCondition) {
641640
parseElements(Elements, isActive);
642-
} else if (SyntaxContext->isEnabled()) {
643-
// We shouldn't skip code if we are building syntax tree.
644-
// The parser will keep running and we just discard the AST part.
645-
DiagnosticSuppression suppression(Context.Diags);
646-
SmallVector<ASTNode, 16> dropedElements;
647-
parseElements(dropedElements, false);
648641
} else {
649642
DiagnosticTransaction DT(Diags);
650643
skipUntilConditionalBlockClose();

0 commit comments

Comments
 (0)