Skip to content

Commit 6d89038

Browse files
committed
---
yaml --- r: 341471 b: refs/heads/rxwei-patch-1 c: 0477878 h: refs/heads/master i: 341469: 3d0fa0e 341467: 03a570c 341463: ee2e495 341455: 95e6b73 341439: df109e1
1 parent e4246df commit 6d89038

File tree

8 files changed

+20
-15
lines changed

8 files changed

+20
-15
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: a84972b816d890a1c2d1ba996688feed88730fe5
1018+
refs/heads/rxwei-patch-1: 0477878b093be9ab959f6d452ae19aadcb4dd4c3
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/include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ namespace swift {
314314
/// and faster rebuilds.
315315
bool EnableExperimentalDependencies = false;
316316

317+
/// Enable the experimental opaque result types feature.
318+
bool EnableOpaqueResultTypes = true;
319+
317320
/// To mimic existing system, set to false.
318321
/// To experiment with including file-private and private dependency info,
319322
/// set to true.

branches/rxwei-patch-1/include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ def solver_enable_operator_designated_types :
413413
Flag<["-"], "solver-enable-operator-designated-types">,
414414
HelpText<"Enable operator designated types in constraint solver">;
415415

416+
def enable_opaque_result_types :
417+
Flag<["-"], "enable-opaque-result-types">,
418+
HelpText<"Enable experimental opaque result types feature">;
419+
416420
def switch_checking_invocation_threshold_EQ : Joined<["-"],
417421
"switch-checking-invocation-threshold=">;
418422

branches/rxwei-patch-1/lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
276276
Opts.EnableOperatorDesignatedTypes |=
277277
Args.hasArg(OPT_enable_operator_designated_types);
278278

279+
Opts.EnableOpaqueResultTypes |=
280+
Args.hasArg(OPT_enable_opaque_result_types);
281+
279282
// Always enable operator designated types for the standard library.
280283
Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib;
281284

branches/rxwei-patch-1/lib/Parse/ParseType.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
697697
// This is only semantically allowed in certain contexts, but we parse it
698698
// generally for diagnostics and recovery.
699699
SourceLoc opaqueLoc;
700-
if (Tok.is(tok::identifier) && Tok.getRawText() == "some") {
700+
if (Context.LangOpts.EnableOpaqueResultTypes
701+
&& Tok.is(tok::identifier)
702+
&& Tok.getRawText() == "some") {
701703
// Treat some as a keyword.
702704
TokReceiver->registerTokenKindChange(Tok.getLoc(), tok::contextual_keyword);
703705
opaqueLoc = consumeToken();
@@ -763,7 +765,9 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
763765
}
764766

765767
// Diagnose invalid `some` after an ampersand.
766-
if (Tok.is(tok::identifier) && Tok.getRawText() == "some") {
768+
if (Context.LangOpts.EnableOpaqueResultTypes
769+
&& Tok.is(tok::identifier)
770+
&& Tok.getRawText() == "some") {
767771
auto badLoc = consumeToken();
768772

769773
// TODO: Fixit to move to beginning of composition.

branches/rxwei-patch-1/lib/SIL/SILUndef.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@
1616
using namespace swift;
1717

1818
static ValueOwnershipKind getOwnershipKindForUndef(SILType type, const SILFunction &f) {
19-
if (type.isAddress()) {
20-
// If we have an address only type and we are supposed to use
21-
// lowered addresses, return Owned. Otherwise addresses are any.
22-
if (type.isAddressOnly(f) && f.getConventions().useLoweredAddresses()) {
23-
return ValueOwnershipKind::Owned;
24-
}
25-
return ValueOwnershipKind::Any;
26-
}
27-
28-
if (type.isTrivial(f))
19+
if (type.isAddress() || type.isTrivial(f))
2920
return ValueOwnershipKind::Any;
3021
return ValueOwnershipKind::Owned;
3122
}

branches/rxwei-patch-1/test/Constraints/function_builder_diags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-opaque-result-types
22

33
@_functionBuilder
44
struct TupleBuilder { // expected-note 2{{struct 'TupleBuilder' declared here}}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -typecheck -verify %s
1+
// RUN: %target-swift-frontend -disable-availability-checking -typecheck -verify -enable-opaque-result-types %s
22

33
protocol P {
44
func paul()

0 commit comments

Comments
 (0)