File tree Expand file tree Collapse file tree 4 files changed +87
-1
lines changed Expand file tree Collapse file tree 4 files changed +87
-1
lines changed Original file line number Diff line number Diff line change 1
1
public func bar( ) { }
2
2
3
+ public class Bar {
4
+ @usableFromInline internal class Inner {
5
+
6
+ /// makeX is declared in foo.swift
7
+ var x = makeX ( [ 1 , 2 , 3 , 4 ] )
8
+
9
+ @usableFromInline internal func f( ) {
10
+ print ( " Bar.Inner.f " )
11
+ }
12
+ }
13
+ }
14
+
15
+ #if _runtime(_ObjC) && canImport(Foundation)
16
+
17
+ import Foundation
18
+
19
+ public class ObjCBar : NSObject {
20
+
21
+ @objc ( foo)
22
+ public func bar( ) -> String {
23
+ return " "
24
+ }
25
+
26
+ }
27
+
28
+ #endif
Original file line number Diff line number Diff line change 1
1
public func baz( ) { }
2
+
3
+ public protocol BazProtocol {
4
+ associatedtype Ret
5
+ func method1( ) -> Ret ?
6
+ }
7
+
8
+ public enum Baz < T: Collection > : BazProtocol {
9
+ case collection( T )
10
+ case other
11
+
12
+ public func method1( ) -> T . SubSequence ? {
13
+ switch self {
14
+ case . collection( let collection) :
15
+ return makeX ( collection)
16
+ default :
17
+ return nil
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change 1
- public func foo( ) { }
1
+ @inlinable
2
+ public func foo( x: Int ) -> Int {
3
+ return x + 1
4
+ }
2
5
6
+ /// something
7
+ func makeX< T: Collection > ( _ seed: T ) -> T . SubSequence {
8
+ return seed. dropFirst ( 1 )
9
+ }
10
+
11
+ public struct Foo : BazProtocol {
12
+ /// varx
13
+ public var x = makeX ( " foobar " )
14
+
15
+ /// method
16
+ public func method1( ) -> Int ? { return 1 }
17
+
18
+ /* Foo Bar */
19
+ @_transparent
20
+ public func method2( x: Int ) -> Int {
21
+ return x * 12
22
+ }
23
+
24
+ @inlinable
25
+ public func method3< T: Equatable > ( x: T , y: T ) -> T {
26
+ return x == y ? x : y
27
+ }
28
+ }
Original file line number Diff line number Diff line change 63
63
// RUN: test ! -f %t/buildrecord.swiftdeps~moduleonly
64
64
// RUN: test -f %t/buildrecord.swiftdeps
65
65
// RUN: test -f %t/foo~partial.swiftmodule
66
+
67
+ // Ensure '-emit-module' and '-c -emit-module' emits identical 'swiftmodule' and 'swiftdoc' file.
68
+ //
69
+ // RUN: rm -f %t-moduleonly.swiftmodule
70
+ // RUN: rm -f %t-moduleonly.swiftdoc
71
+ // RUN: rm -rf %t && cp -r %S/Inputs/moduleonly/ %t
72
+ // RUN: touch -t 201801230045 %t/*.swift
73
+ // RUN: cd %t && %target-build-swift -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1
74
+ // RUN: cp -f %t/testmodule.swiftmodule %t-moduleonly.swiftmodule
75
+ // RUN: cp -f %t/testmodule.swiftdoc %t-moduleonly.swiftdoc
76
+ // RUN: rm -rf %t && cp -r %S/Inputs/moduleonly/ %t
77
+ // RUN: touch -t 201801230045 %t/*.swift
78
+ // RUN: cd %t && %target-build-swift -c -emit-module -output-file-map ./output.json -incremental ./foo.swift ./bar.swift ./baz.swift -module-name testmodule -v 2>&1
79
+ // RUN: diff %t/testmodule.swiftmodule %t-moduleonly.swiftmodule
80
+ // RUN: diff %t/testmodule.swiftdoc %t-moduleonly.swiftdoc
You can’t perform that action at this time.
0 commit comments