diff --git a/compiler/testData/diagnostics/ReadMe.md b/compiler/testData/diagnostics/ReadMe.md new file mode 100644 index 00000000000..014110bb098 --- /dev/null +++ b/compiler/testData/diagnostics/ReadMe.md @@ -0,0 +1,44 @@ +Several directives can be added in the beginning of a test file in the syntax: + +`// !DIRECTIVE` + +## Directives: + +### 1. DIAGNOSTICS + +Must be + + '([ + - ! ] DIAGNOSTIC_FACTORY_NAME | ERROR | WARNING | INFO ) +' + + where + +* `'+'` means 'include'; +* `'-'` means 'exclude'; +* `'!'` means 'exclude everything but this'. + + Directives are applied in the order of appearance, + i.e. `!FOO +BAR` means include only `FOO` and `BAR`. + +#### Examples: + + // !DIAGNOSTICS: -WARNING +CAST_NEVER_SUCCEEDS + + // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + + +### 2. CHECK_TYPE + +The directive adds the following declarations to the file: + + class _ + fun T.checkType(f: (_) -> Unit) = f + +With that, an exact type of an expression can be checked in the following way: + + fun test(expr: A) { + expr checkType { it: _ } + } + +#### Usage: + + // !CHECK_TYPE \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java index ce81f5bea05..c00ec007349 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java @@ -150,7 +150,7 @@ public abstract class BaseDiagnosticsTest extends JetLiteFixture { "where '+' means 'include'\n" + " '-' means 'exclude'\n" + " '!' means 'exclude everything but this'\n" + - "directives are applied in the order of appearance, i.e. !FOO +BAR means inluce only FOO and BAR"); + "directives are applied in the order of appearance, i.e. !FOO +BAR means include only FOO and BAR"); } boolean first = true; do {