Skip to content

Commit 94753e5

Browse files
authored
Merge pull request swiftlang#83873 from owenv/owenv/testable-docs
Document the 'module not testable' diagnostic
2 parents 9c89820 + b7a910e commit 94753e5

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

include/swift/AST/DiagnosticGroups.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ GROUP(ImplementationOnlyDeprecated, "implementation-only-deprecated")
5353
GROUP(IsolatedConformances, "isolated-conformances")
5454
GROUP(MemberImportVisibility, "member-import-visibility")
5555
GROUP(MissingModuleOnKnownPaths, "missing-module-on-known-paths")
56+
GROUP(ModuleNotTestable, "module-not-testable")
5657
GROUP(ModuleVersionMissing, "module-version-missing")
5758
GROUP(MultipleInheritance, "multiple-inheritance")
5859
GROUP(MutableGlobalVariable, "mutable-global-variable")

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ ERROR(imported_decl_is_wrong_kind_typealias,none,
12291229
ERROR(ambiguous_decl_in_module,none,
12301230
"ambiguous name %0 in module %1", (Identifier, Identifier))
12311231

1232-
ERROR(module_not_testable,Fatal,
1232+
GROUPED_ERROR(module_not_testable,ModuleNotTestable,Fatal,
12331233
"module %0 was not compiled for testing", (Identifier))
12341234

12351235
ERROR(module_not_compiled_for_private_import,none,

userdocs/diagnostics/diagnostic-descriptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ presented specially within your IDE of choice. See below for the full list of th
2424
- <doc:string-interpolation-conformance>
2525
- <doc:isolated-conformances>
2626
- <doc:error-in-future-swift-version>
27+
- <doc:module-not-testable>
2728
- <doc:multiple-inheritance>
2829
- <doc:nominal-types>
2930
- <doc:property-wrapper-requirements>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Module not testable
2+
3+
Modules imported using `@testable import` must have been compiled using the `-enable-testing` compiler flag.
4+
5+
`@testable import` allows clients of a module to access `internal` API when writing tests. A `@testable import` will report an error if the imported module was not compiled with the `-enable-testing` compiler flag. Use of `-enable-testing` is recommended only in debug builds or other builds not intended for production use.

0 commit comments

Comments
 (0)