File: diagnostics.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (99 lines) | stat: -rw-r--r-- 5,797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s | %FileCheck %s -check-prefix=NODIAGS
// REQUIRES: no_asan

// NODIAGS: key.notification: source.notification.compile-did-finish
// NODIAGS-NEXT: key.diagnostics: [
// NODIAGS-NEXT: ]

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %S/Inputs/parse-error.swift -- %S/Inputs/parse-error.swift | %FileCheck %s -check-prefix=PARSE
// PARSE: key.notification: source.notification.compile-did-finish
// PARSE-NEXT: key.diagnostics: [
// PARSE-NEXT:   {
// PARSE-NEXT:     key.line: 1
// PARSE-NEXT:     key.column: 6
// PARSE-NEXT:     key.filepath: "{{.*}}parse-error.swift"
// PARSE-NEXT:     key.severity: source.diagnostic.severity.error
// PARSE-NEXT:     key.id: "number_cant_start_decl_name"
// PARSE-NEXT:     key.description: "function name
// PARSE-NEXT:   }
// PARSE-NEXT: ]

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %S/Inputs/parse-error-with-sourceLocation.swift -- %S/Inputs/parse-error-with-sourceLocation.swift | %FileCheck %s -check-prefix=PARSE-WITH-SOURCELOCATION
// PARSE-WITH-SOURCELOCATION: key.notification: source.notification.compile-did-finish
// PARSE-WITH-SOURCELOCATION-NEXT: key.diagnostics: [
// PARSE-WITH-SOURCELOCATION-NEXT:   {
// PARSE-WITH-SOURCELOCATION-NEXT:     key.line: 2000
// PARSE-WITH-SOURCELOCATION-NEXT:     key.column: 6
// PARSE-WITH-SOURCELOCATION-NEXT:     key.filepath: "custom.swuft"
// PARSE-WITH-SOURCELOCATION-NEXT:     key.severity: source.diagnostic.severity.error
// PARSE-WITH-SOURCELOCATION-NEXT:     key.id: "number_cant_start_decl_name"
// PARSE-WITH-SOURCELOCATION-NEXT:     key.description: "function name
// PARSE-WITH-SOURCELOCATION-NEXT:   }
// PARSE-WITH-SOURCELOCATION-NEXT: ]

// Diagnostic from other file.
// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s %S/Inputs/parse-error.swift | %FileCheck %s -check-prefix=PARSE

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %S/Inputs/sema-error.swift -- %S/Inputs/sema-error.swift | %FileCheck %s -check-prefix=SEMA
// SEMA: key.notification: source.notification.compile-did-finish
// SEMA-NEXT: key.diagnostics: [
// SEMA-NEXT:   {
// SEMA-NEXT:     key.line: 1
// SEMA-NEXT:     key.column: 5
// SEMA-NEXT:     key.filepath: "{{.*}}sema-error.swift"
// SEMA-NEXT:     key.severity: source.diagnostic.severity.error
// SEMA-NEXT:     key.id: "cannot_find_in_scope"
// SEMA-NEXT:     key.description: "cannot find '{{.*}}' in scope
// SEMA-NEXT:     key.ranges: [

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s -Xcc -include -Xcc /doesnotexist | %FileCheck %s -check-prefix=CLANG_IMPORTER
// CLANG_IMPORTER: key.notification: source.notification.compile-did-finish,
// CLANG_IMPORTER-NEXT: key.diagnostics: [
// CLANG_IMPORTER-NEXT:   {
// CLANG_IMPORTER-NEXT:     key.line:
// CLANG_IMPORTER-NEXT:     key.column:
// CLANG_IMPORTER-NEXT:     key.filepath: "<{{.*}}>"
// CLANG_IMPORTER-NEXT:     key.severity: source.diagnostic.severity.error,
// CLANG_IMPORTER-NEXT:     key.id: "error_from_clang"
// CLANG_IMPORTER-NEXT:     key.description: {{.*}}not found

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s -Xcc -ivfsoverlay -Xcc /doesnotexist | %FileCheck %s -check-prefix=CLANG_IMPORTER_UNKNOWN
// CLANG_IMPORTER_UNKNOWN: key.notification: source.notification.compile-did-finish,
// CLANG_IMPORTER_UNKNOWN-NEXT: key.diagnostics: [
// CLANG_IMPORTER_UNKNOWN-NEXT:   {
// CLANG_IMPORTER_UNKNOWN-NEXT:     key.filepath: "<unknown>"
// CLANG_IMPORTER_UNKNOWN-NEXT:     key.severity: source.diagnostic.severity.error,
// CLANG_IMPORTER_UNKNOWN-NEXT:     key.offset: 0
// CLANG_IMPORTER_UNKNOWN-NEXT:     key.id: "error_from_clang"
// CLANG_IMPORTER_UNKNOWN-NEXT:     key.description: "virtual filesystem{{.*}}not found

// Note: we're missing the "compiler is in code completion mode" diagnostic,
// which is probably just as well.
// RUN: %sourcekitd-test -req=track-compiles == -req=complete -offset=0 %s -- %s | %FileCheck %s -check-prefix=NODIAGS
// RUN: %sourcekitd-test -req=track-compiles == -req=complete -pos=2:1 %S/Inputs/sema-error.swift -- %S/Inputs/sema-error.swift | %FileCheck %s -check-prefix=NODIAGS

// FIXME: invalid arguments cause us to early-exit and not send the notifications
// RUN_DISABLED: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s -invalid-arg | %FileCheck %s -check-prefix=INVALID_ARG

// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s -Xcc -invalid-arg | %FileCheck %s -check-prefix=INVALID_ARG
// INVALID_ARG: key.notification: source.notification.compile-did-finish,
// INVALID_ARG-NEXT: key.diagnostics: [
// INVALID_ARG-NEXT:   {
// INVALID_ARG-NEXT:     key.filepath: "<unknown>"
// INVALID_ARG-NEXT:     key.severity: source.diagnostic.severity.error,
// INVALID_ARG-NEXT:     key.offset: 0
// INVALID_ARG-NEXT:     key.id: "{{error_from_clang|error_unknown_arg}}"
// INVALID_ARG-NEXT:     key.description: "unknown argument

// Ignore the spurious -wmo + -enable-batch-mode warning.
// RUN: %sourcekitd-test -req=track-compiles == -req=sema %s -- %s -enable-batch-mode | %FileCheck %s -check-prefix=NODIAGS
// RUN: %sourcekitd-test -req=track-compiles == -req=complete -offset=0 %s -- %s -enable-batch-mode | %FileCheck %s -check-prefix=NODIAGS

// Report syntactic-only requests that have arguments.
// RUN: %sourcekitd-test -req=track-compiles == -req=syntax-map %s -- %s -invalid-arg | %FileCheck %s -check-prefix=INVALID_ARG
// But ignore syntactic-only requests with no arguments.
// RUN: %sourcekitd-test -req=track-compiles == -req=syntax-map %s | %FileCheck %s -check-prefix=SYNTACTIC
// SYNTACTIC: key.syntaxmap:

// TODO: Is this correct?  this correct? rdar://102092136
// SYNTACTIC: key.notification: source.notification.compile-did-finish