Skip to content

Commit fa574ba

Browse files
committed
don't share MemberVariables module when testing diagnostics
This header is shared by 3 tests, one of which checks diagnostics. If that test picks up an already built module from the module cache, it won't pick up diagnostics in the header. This duplicates the header as two separate modules rather than specifying an explicit module cache, to avoid rebuilding CxxStdlib.
1 parent a8a1a2e commit fa574ba

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

test/Interop/Cxx/class/Inputs/module.modulemap

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ module MemoryLayout {
4848
requires cplusplus
4949
}
5050

51-
module MemberVariables {
51+
// This header is shared between 3 test cases. It's built with -verify in
52+
// test/Interop/Cxx/class/member-variables-typechecker.swift, which is defeated
53+
// if the test just picks up a cached module. We could set the module cache path
54+
// explicitly, but that would rebuild CxxStdlib which is really slow.
55+
module MemberVariablesNoDiagnostics {
56+
header "member-variables.h"
57+
requires cplusplus
58+
}
59+
module MemberVariablesDiagnostics {
5260
header "member-variables.h"
5361
requires cplusplus
5462
}

test/Interop/Cxx/class/member-variables-module-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberVariables -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberVariablesNoDiagnostics -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
22

33
// CHECK: struct MyClass {
44
// CHECK-NEXT: init()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop
22

3-
import MemberVariables
3+
import MemberVariablesDiagnostics
44

55
var s = MyClass()
66
s.const_member = 42 // expected-error {{cannot assign to property: 'const_member' setter is inaccessible}}

test/Interop/Cxx/class/zero-sized-field.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// REQUIRES: executable_test
55

66
import StdlibUnittest
7-
import MemberVariables
7+
import MemberVariablesNoDiagnostics
88

99
var FieldsTestSuite = TestSuite("Generating code with zero sized fields")
1010

0 commit comments

Comments
 (0)