File tree Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Original file line number Diff line number Diff line change 22//
33// This source file is part of the Swift.org open source project
44//
5- // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
5+ // Copyright (c) 2024-2025 Apple Inc. and the Swift.org project authors
66// Licensed under Apache License v2.0
77//
88// See LICENSE.txt for license information
@@ -84,7 +84,7 @@ final class Swift2JavaVisitor {
8484 }
8585
8686 func visit( extensionDecl node: ExtensionDeclSyntax , in parent: ImportedNominalType ? ) {
87- guard parent ! = nil else {
87+ guard parent = = nil else {
8888 // 'extension' in a nominal type is invalid. Ignore
8989 return
9090 }
Original file line number Diff line number Diff line change 1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2025 Apple Inc. and the Swift.org project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
14+
15+ import JExtractSwiftLib
16+ import Testing
17+
18+ final class ExtensionImportTests {
19+ let interfaceFile =
20+ """
21+ extension MyStruct {
22+ public func methodInExtension() {}
23+ }
24+
25+ public struct MyStruct {}
26+ """
27+
28+ @Test ( " Import extensions: Swift thunks " )
29+ func data_swiftThunk( ) throws {
30+ try assertOutput (
31+ input: interfaceFile, . ffm, . swift,
32+ expectedChunks: [
33+ """
34+ @_cdecl( " swiftjava_getType_SwiftModule_MyStruct " )
35+ public func swiftjava_getType_SwiftModule_MyStruct() -> UnsafeMutableRawPointer /* Any.Type */ {
36+ return unsafeBitCast(MyStruct.self, to: UnsafeMutableRawPointer.self)
37+ }
38+ """ ,
39+ """
40+ @_cdecl( " swiftjava_SwiftModule_MyStruct_methodInExtension " )
41+ public func swiftjava_SwiftModule_MyStruct_methodInExtension(_ self: UnsafeRawPointer) {
42+ self.assumingMemoryBound(to: MyStruct.self).pointee.methodInExtension()
43+ }
44+ """
45+ ]
46+ )
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments