Skip to content

Commit 2fb75af

Browse files
authored
---
yaml --- r: 335839 b: refs/heads/rxwei-patch-1 c: 0d27af4 h: refs/heads/master i: 335837: da4caf3 335835: 509f5bb 335831: acd6099 335823: d4825b1 335807: 70ff35b
1 parent cb8a510 commit 2fb75af

File tree

10 files changed

+118
-93
lines changed

10 files changed

+118
-93
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 03f7fb75e044f9b9c8b74b5c3f8ab1b0b153cf77
1018+
refs/heads/rxwei-patch-1: 0d27af4fb87e5bc834579d56466ec6a607d4fa05
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ static void addMandatoryOptPipeline(SILPassPipelinePlan &P) {
9999
// optimizer pipeline is run implying we can put a pass that requires OSSA
100100
// there.
101101
const auto &Options = P.getOptions();
102-
if (Options.EnableMandatorySemanticARCOpts && Options.shouldOptimize()) {
102+
P.addClosureLifetimeFixup();
103+
if (Options.shouldOptimize()) {
103104
P.addSemanticARCOpts();
104105
}
105-
P.addClosureLifetimeFixup();
106106
if (Options.StripOwnershipDuringDiagnosticsPipeline)
107107
P.addOwnershipModelEliminator();
108108
P.addMandatoryInlining();

branches/rxwei-patch-1/lib/Sema/TypeCheckType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,10 @@ static Type diagnoseUnknownType(TypeResolution resolution,
10631063
AbstractFunctionDecl *methodDecl = dc->getInnermostMethodContext();
10641064
bool declaringMethod = methodDecl &&
10651065
methodDecl->getDeclContext() == dc->getParentForLookup();
1066+
bool isPropertyOfClass = insideClass &&
1067+
options.is(TypeResolverContext::PatternBindingDecl);
10661068

1067-
if (((!insideClass || !declaringMethod) &&
1069+
if (((!insideClass || !declaringMethod) && !isPropertyOfClass &&
10681070
!options.is(TypeResolverContext::GenericRequirement)) ||
10691071
options.is(TypeResolverContext::ExplicitCastExpr)) {
10701072
Type SelfType = nominal->getSelfInterfaceType();

branches/rxwei-patch-1/test/Frontend/dependencies.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// CHECK-BASIC-LABEL: - :
1111
// CHECK-BASIC: Inputs/empty\ file.swift
1212
// CHECK-BASIC: Swift.swiftmodule
13-
// CHECK-BASIC-NOT: {{[^\\]}}:
13+
// CHECK-BASIC-NOT: {{ }}:{{ }}
1414

1515
// CHECK-BASIC-YAML-LABEL: depends-external:
1616
// CHECK-BASIC-YAML-NOT: empty\ file.swift
@@ -37,7 +37,7 @@
3737
// CHECK-MULTIPLE-OUTPUTS-LABEL: empty\ file.h :
3838
// CHECK-MULTIPLE-OUTPUTS: Inputs/empty\ file.swift
3939
// CHECK-MULTIPLE-OUTPUTS: Swift.swiftmodule
40-
// CHECK-MULTIPLE-OUTPUTS-NOT: {{[^\\]}}:
40+
// CHECK-MULTIPLE-OUTPUTS-NOT: {{ }}:{{ }}
4141

4242
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -resolve-imports %s | %FileCheck -check-prefix=CHECK-IMPORT %s
4343
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/dependencies/extra-header.h -track-system-dependencies -emit-dependencies-path - -resolve-imports %s | %FileCheck -check-prefix=CHECK-IMPORT-TRACK-SYSTEM %s

branches/rxwei-patch-1/test/IDE/Inputs/mock-sdk/FooHelper.framework/Frameworks/FooHelperSub.framework/Headers/FooHelperSub.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
#ifndef FooHelperSub_FooHelperSub_h
3+
#define FooHelperSub_FooHelperSub_h
4+
15
int fooHelperSubFunc1(int a);
26

37
enum FooHelperSubEnum1 {
@@ -9,3 +13,5 @@ enum {
913
FooHelperSubUnnamedEnumeratorA1
1014
};
1115

16+
#endif
17+
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#import <FooHelperSub/FooHelperSub.h>
1+
2+
#ifndef FooHelper_FooHelper_h
3+
#define FooHelper_FooHelper_h
4+
5+
#include <FooHelperSub/FooHelperSub.h>
26

37
int fooHelperFunc1(int a);
48

@@ -7,3 +11,5 @@ enum {
711
FooHelperUnnamedEnumeratorA2,
812
};
913

14+
#endif
15+

branches/rxwei-patch-1/test/Index/Store/output-failure.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: mkdir %t/idx
3+
// UNSUPPORTED: OS=windows-msvc
34

45
// Before indexing, do a dry-run to ensure any clang modules are cached. We
56
// want to isolate the error that comes from swift's indexing support, not

branches/rxwei-patch-1/test/type/self.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ class A<T> {
7070
// expected-warning@-1 {{conditional cast from 'Self' to 'Self' always succeeds}}
7171
// expected-warning@-2 {{conditional downcast from 'Self?' to 'A<T>' is equivalent to an implicit conversion to an optional 'A<T>'}}
7272
}
73+
func copy() -> Self {
74+
let copy = Self.init(a: 11)
75+
return copy
76+
}
77+
78+
var copied: Self { // expected-error {{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'A'?}}
79+
let copy = Self.init(a: 11)
80+
return copy
81+
}
7382
}
7483

7584
class B: A<Int> {
@@ -88,6 +97,14 @@ class B: A<Int> {
8897
override class func y() {
8998
print("override \(Self.self).\(#function)")
9099
}
100+
override func copy() -> Self {
101+
let copy = super.copy() as! Self // supported
102+
return copy
103+
}
104+
override var copied: Self { // expected-error {{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'B'?}}
105+
let copy = super.copied as! Self // unsupported
106+
return copy
107+
}
91108
}
92109

93110
class C {
@@ -121,6 +138,15 @@ struct S2 {
121138
// expected-warning@-1 {{conditional cast from 'S2.S3<T>' to 'S2.S3<T>' always succeeds}}
122139
}
123140
}
141+
func copy() -> Self {
142+
let copy = Self.init()
143+
return copy
144+
}
145+
146+
var copied: Self {
147+
let copy = Self.init()
148+
return copy
149+
}
124150
}
125151

126152
extension S2 {

branches/rxwei-patch-1/tools/swift-api-digester/ModuleAnalyzerNodes.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "swift/AST/USRGeneration.h"
3939
#include "swift/AST/GenericSignature.h"
4040
#include "swift/AST/ProtocolConformance.h"
41+
#include "swift/AST/DiagnosticsModuleDiffer.h"
4142
#include "swift/Basic/ColorUtils.h"
4243
#include "swift/Basic/JSONSerialization.h"
4344
#include "swift/Basic/LLVMInitialize.h"
@@ -195,6 +196,7 @@ class SDKContext {
195196
bool shouldIgnore(Decl *D, const Decl* Parent = nullptr) const;
196197
ArrayRef<BreakingAttributeInfo> getBreakingAttributeInfo() const { return BreakingAttrs; }
197198
Optional<uint8_t> getFixedBinaryOrder(ValueDecl *VD) const;
199+
198200
template<class YAMLNodeTy, typename ...ArgTypes>
199201
void diagnose(YAMLNodeTy node, Diag<ArgTypes...> ID,
200202
typename detail::PassArgument<ArgTypes>::type... args) {
@@ -336,6 +338,19 @@ class SDKNodeDecl: public SDKNode {
336338
uint8_t getFixedBinaryOrder() const { return *FixedBinaryOrder; }
337339
virtual void jsonize(json::Output &Out) override;
338340
virtual void diagnose(SDKNode *Right) override;
341+
342+
// The first argument of the diag is always screening info.
343+
template<typename ...ArgTypes>
344+
void emitDiag(Diag<StringRef, ArgTypes...> ID,
345+
typename detail::PassArgument<ArgTypes>::type... Args) const {
346+
// Don't emit objc decls if we care about swift exclusively
347+
if (Ctx.getOpts().SwiftOnly) {
348+
if (isObjc())
349+
return;
350+
}
351+
Ctx.getDiags().diagnose(SourceLoc(), ID, getScreenInfo(),
352+
std::move(Args)...);
353+
}
339354
};
340355

341356
class SDKNodeRoot: public SDKNode {

0 commit comments

Comments
 (0)