File: conflicting-import-restrictions.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (64 lines) | stat: -rw-r--r-- 3,105 bytes parent folder | download | duplicates (2)
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
/// Test conflicting imports modifiers from the same line.

// RUN: %empty-directory(%t)
// RUN: split-file %s %t

/// Generate dependencies.
// RUN: %target-swift-frontend -emit-module %t/Lib.swift \
// RUN:   -module-name Lib -emit-module-path %t/Lib.swiftmodule \
// RUN:   -swift-version 5 -enable-library-evolution

/// Build clients.
// RUN: %target-swift-frontend -typecheck %t/SPIOnly_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/Exported_SPIOnly.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/SPIOnly_IOI.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/SPIOnly_IOI_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify

//--- Lib.swift
// Empty source file for import.

//--- SPIOnly_Exported.swift
@_spiOnly @_exported import Lib // expected-error {{module 'Lib' cannot be both exported and SPI only}}

//--- Exported_SPIOnly.swift
@_exported @_spiOnly import Lib // expected-error {{module 'Lib' cannot be both exported and SPI only}}

//--- SPIOnly_IOI.swift
@_spiOnly @_implementationOnly import Lib // expected-error {{module 'Lib' cannot be both implementation-only and SPI only}}

//--- Exported_IOI.swift
@_exported @_implementationOnly import Lib // expected-error {{module 'Lib' cannot be both exported and implementation-only}}

//--- SPIOnly_IOI_Exported.swift
@_spiOnly @_implementationOnly @_exported import Lib // expected-error {{module 'Lib' cannot be both exported and implementation-only}}

/// Access levels on imports
// RUN: %target-swift-frontend -typecheck %t/Public_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/Package_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/Internal_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/Fileprivate_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify
// RUN: %target-swift-frontend -typecheck %t/Private_Exported.swift -I %t -verify \
// RUN:   -experimental-spi-only-imports -verify

//--- Public_Exported.swift
@_exported public import Lib

//--- Package_Exported.swift
@_exported package import Lib // expected-error {{'@_exported' is incompatible with 'package'; it can only be applied to public imports}}

//--- Internal_Exported.swift
@_exported internal import Lib // expected-error {{'@_exported' is incompatible with 'internal'; it can only be applied to public imports}}

//--- Fileprivate_Exported.swift
@_exported fileprivate import Lib // expected-error {{'@_exported' is incompatible with 'fileprivate'; it can only be applied to public imports}}

//--- Private_Exported.swift
@_exported private import Lib // expected-error {{'@_exported' is incompatible with 'private'; it can only be applied to public imports}}