File: objc_implementation.swift

package info (click to toggle)
swiftlang 6.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,644 kB
  • sloc: cpp: 9,901,738; ansic: 2,201,433; 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 (26 lines) | stat: -rw-r--r-- 1,336 bytes parent folder | download
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
// RUN: %empty-directory(%t)
// RUN: %target-typecheck-verify-swift -target %target-stable-abi-triple -module-name main -I %S/Inputs %s
// RUN: %target-swift-frontend -emit-module -target %target-stable-abi-triple -module-name main -o %t -I %S/Inputs %s
// RUN: llvm-bcanalyzer %t/main.swiftmodule > %t/main.swiftmodule.txt
// RUN: %target-swift-ide-test -print-module -target %target-stable-abi-triple -module-to-print=main -I %t -source-filename=%s >%t/main.txt
// RUN: %FileCheck %s --input-file=%t/main.txt

// REQUIRES: objc_interop

import Foundation
import objc_implementation

// rdar://134730183 - ensure that errors reduced to warnings by early adopter
// syntax don't invalidate the @implementation attribute (and cause it to not
// be serialized)

// CHECK-LABEL: @_objcImplementation extension ObjCImpl
@_objcImplementation extension ObjCImpl {
  // CHECK-DAG: func cannotBeObjCMethod(_ value: Int?)
  private func cannotBeObjCMethod(_ value: Int?) {}
  // expected-warning@-1 {{instance method 'cannotBeObjCMethod' will become implicitly '@objc' after adopting '@objc @implementation'; add 'final' to keep the current behavior}} {{3-3=final }}
  // expected-note@-2 {{add '@objc' to expose this instance method to Objective-C}} {{3-3=@objc }}

  // CHECK-DAG: @objc func goodMethod()
  @objc public func goodMethod() {}
}