Skip to content

Commit ab5c3b1

Browse files
committed
---
yaml --- r: 323059 b: refs/heads/tensorflow-next c: 0e42771 h: refs/heads/master i: 323057: 91003af 323055: 8151d5a
1 parent 8768e42 commit ab5c3b1

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: 3a4993f76606eb3af817131a5927ce2d8c806625
1464+
refs/heads/tensorflow-next: 0e427711e4ca7a3340e104d14d199b20c271ee92

branches/tensorflow-next/lib/AST/DiagnosticEngine.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,14 @@ static DiagnosticKind toDiagnosticKind(DiagnosticState::Behavior behavior) {
622622
llvm_unreachable("Unhandled DiagnosticKind in switch.");
623623
}
624624

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.
627627
llvm::cl::opt<bool> AssertOnError("swift-diagnostics-assert-on-error",
628628
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));
629633

630634
DiagnosticState::Behavior DiagnosticState::determineBehavior(DiagID id) {
631635
auto set = [this](DiagnosticState::Behavior lvl) {
@@ -637,6 +641,8 @@ DiagnosticState::Behavior DiagnosticState::determineBehavior(DiagID id) {
637641
}
638642

639643
assert((!AssertOnError || !anyErrorOccurred) && "We emitted an error?!");
644+
assert((!AssertOnWarning || (lvl != Behavior::Warning)) &&
645+
"We emitted a warning?!");
640646
previousBehavior = lvl;
641647
return lvl;
642648
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
internal class TestClass {
2+
internal var field = "goodbye"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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

0 commit comments

Comments
 (0)