File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
1461
1461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
1462
1462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
1463
1463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464
- refs/heads/tensorflow-next: 3a4993f76606eb3af817131a5927ce2d8c806625
1464
+ refs/heads/tensorflow-next: 0e427711e4ca7a3340e104d14d199b20c271ee92
Original file line number Diff line number Diff line change @@ -622,10 +622,14 @@ static DiagnosticKind toDiagnosticKind(DiagnosticState::Behavior behavior) {
622
622
llvm_unreachable (" Unhandled DiagnosticKind in switch." );
623
623
}
624
624
625
- // / A special option only for compiler writers that causes Diagnostics to assert
626
- // / when a failure diagnostic is emitted. Intended for use in the debugger.
625
+ // A special option only for compiler writers that causes Diagnostics to assert
626
+ // when a failure diagnostic is emitted. Intended for use in the debugger.
627
627
llvm::cl::opt<bool > AssertOnError (" swift-diagnostics-assert-on-error" ,
628
628
llvm::cl::init (false ));
629
+ // A special option only for compiler writers that causes Diagnostics to assert
630
+ // when a warning diagnostic is emitted. Intended for use in the debugger.
631
+ llvm::cl::opt<bool > AssertOnWarning (" swift-diagnostics-assert-on-warning" ,
632
+ llvm::cl::init (false ));
629
633
630
634
DiagnosticState::Behavior DiagnosticState::determineBehavior (DiagID id) {
631
635
auto set = [this ](DiagnosticState::Behavior lvl) {
@@ -637,6 +641,8 @@ DiagnosticState::Behavior DiagnosticState::determineBehavior(DiagID id) {
637
641
}
638
642
639
643
assert ((!AssertOnError || !anyErrorOccurred) && " We emitted an error?!" );
644
+ assert ((!AssertOnWarning || (lvl != Behavior::Warning)) &&
645
+ " We emitted a warning?!" );
640
646
previousBehavior = lvl;
641
647
return lvl;
642
648
};
Original file line number Diff line number Diff line change
1
+ internal class TestClass {
2
+ internal var field = " goodbye "
3
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift -force-single-frontend-invocation -c -o %t/Module.o -enable-testing -parse-as-library -emit-module -emit-module-path %t/Module.swiftmodule -module-name Module %S/Inputs/testable_key_path_2.swift
3
+ // RUN: %target-build-swift -o %t/a.out -I %t %s %t/Module.o
4
+ // RUN: %target-run %t/a.out | %FileCheck %s
5
+
6
+ // REQUIRES: executable_test
7
+
8
+ @testable import Module
9
+
10
+ let c = TestClass ( )
11
+
12
+ print ( " You say \( c. field) " )
13
+
14
+ let kp = \TestClass . field
15
+
16
+ c [ keyPath: kp] = " hello "
17
+
18
+ print ( " I say \( c. field) " )
19
+
20
+ // CHECK: I say hello
You can’t perform that action at this time.
0 commit comments