|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: mkdir -p %t/clang-module-cache |
| 3 | +// RUN: mkdir -p %t/inputs |
| 4 | +// RUN: mkdir -p %t/barinputs |
| 5 | +// RUN: echo "public func foo() {}" >> %t/foo.swift |
| 6 | +// RUN: %target-swift-frontend -emit-module -emit-module-path %t/inputs/Foo.swiftmodule -emit-module-doc-path %t/inputs/Foo.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/inputs/Foo.swiftsourceinfo -module-cache-path %t.module-cache %t/foo.swift -module-name Foo -user-module-version 9001 |
| 7 | +// RUN: echo "public func bar() {}" >> %t/bar.swift |
| 8 | +// RUN: %target-swift-frontend -emit-module -emit-module-path %t/barinputs/Bar.swiftmodule -emit-module-doc-path %t/barinputs/Bar.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/barinputs/Bar.swiftsourceinfo -module-cache-path %t.module-cache %t/bar.swift -module-name Bar |
| 9 | + |
| 10 | +// RUN: echo "[{" > %/t/inputs/map.json |
| 11 | +// RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json |
| 12 | +// RUN: echo "\"modulePath\": \"%/t/inputs/Foo.swiftmodule\"," >> %/t/inputs/map.json |
| 13 | +// RUN: echo "\"docPath\": \"%/t/inputs/Foo.swiftdoc\"," >> %/t/inputs/map.json |
| 14 | +// RUN: echo "\"sourceInfoPath\": \"%/t/inputs/Foo.swiftsourceinfo\"," >> %/t/inputs/map.json |
| 15 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 16 | +// RUN: echo "}]" >> %/t/inputs/map.json |
| 17 | + |
| 18 | +// RUN: not %target-swift-frontend -typecheck %s -explicit-swift-module-map-file %t/inputs/map.json -disable-implicit-swift-modules |
| 19 | +// RUN: %target-swift-frontend -typecheck %s -explicit-swift-module-map-file %t/inputs/map.json -I %t/barinputs -Rmodule-loading 2>&1 | %FileCheck %s |
| 20 | + |
| 21 | +#if canImport(Foo, _version: 9000) |
| 22 | +import Bar |
| 23 | +#endif |
| 24 | + |
| 25 | +// 'Bar' can only be imported if the explicitly-loaded 'Foo' is known to be over 9000 |
| 26 | +// CHECK: remark: loaded module 'Bar' |
0 commit comments