File: superclass.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (56 lines) | stat: -rw-r--r-- 2,528 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
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
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-sil -enable-objc-interop -o - -emit-module-path %t/Lib.swiftmodule -module-name Lib -I %S/Inputs/custom-modules %s > /dev/null

// RUN: %target-swift-ide-test -enable-objc-interop -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules | %FileCheck -check-prefix CHECK -check-prefix CHECK-ALWAYS %s

// RUN: %target-swift-ide-test -enable-objc-interop -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD | %FileCheck -check-prefix CHECK-RECOVERY -check-prefix CHECK-ALWAYS %s

// RUN: %target-swift-frontend -typecheck -enable-objc-interop -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST %s -verify

#if TEST

import Lib

func use(_: C2_CRTPish) {}
func use(_: C3_NestingCRTPish) {}
func use(_: C4_ExtensionNestingCRTPish) {}

// FIXME: Better to import the class and make it unavailable.
func use(_: A1_Sub) {} // expected-error {{cannot find type 'A1_Sub' in scope}}
func use(_: A2_Grandchild) {} // expected-error {{cannot find type 'A2_Grandchild' in scope}}

#else // TEST

import SuperclassObjC

// CHECK-LABEL: class A1_Sub : DisappearingSuperclass {
// CHECK-RECOVERY-NOT: class A1_Sub
public class A1_Sub: DisappearingSuperclass {}
// CHECK-LABEL: class A2_Grandchild : A1_Sub {
// CHECK-RECOVERY-NOT: class A2_Grandchild
public class A2_Grandchild: A1_Sub {}

// CHECK-LABEL: class B1_ConstrainedGeneric<T> where T : DisappearingSuperclass {
// CHECK-RECOVERY-NOT: class B1_ConstrainedGeneric
public class B1_ConstrainedGeneric<T> where T: DisappearingSuperclass {}

// CHECK-LABEL: struct B2_ConstrainedGeneric<T> where T : DisappearingSuperclass {
// CHECK-RECOVERY-NOT: struct B2_ConstrainedGeneric
public struct B2_ConstrainedGeneric<T> where T: DisappearingSuperclass {}

// CHECK-ALWAYS-LABEL: class C1_GenericBase<T> {
public class C1_GenericBase<T> {}

// CHECK-ALWAYS-LABEL: class C2_CRTPish : C1_GenericBase<C2_CRTPish> {
public class C2_CRTPish: C1_GenericBase<C2_CRTPish> {}
// CHECK-ALWAYS-LABEL: class C3_NestingCRTPish : C1_GenericBase<C3_NestingCRTPish.Nested> {
public class C3_NestingCRTPish: C1_GenericBase<C3_NestingCRTPish.Nested> {
  public struct Nested {}
}
// CHECK-ALWAYS-LABEL: class C4_ExtensionNestingCRTPish : C1_GenericBase<C4_ExtensionNestingCRTPish.Nested> {
public class C4_ExtensionNestingCRTPish: C1_GenericBase<C4_ExtensionNestingCRTPish.Nested> {}
extension C4_ExtensionNestingCRTPish {
  public struct Nested {}
}

#endif // TEST