mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
With this, we can now get a list of all class members* available in the current translation unit, which will be necessary for doing id-style dynamic lookup (inferring which method you're referring to when the base type is some magic "dynamic lookup" type). * Including members of protocols, since a class we don't know about could have implemented the protocol. Since there is no code currently using this, I've added a new mode to swift-ide-test to just dump all class members -- what will eventually happen when you code complete on a dynamic lookup type. This mode will go away once the other pieces of id-style lookup are in place. Swift SVN r7287
46 lines
1.0 KiB
Swift
46 lines
1.0 KiB
Swift
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: %swift -emit-module -o %t %S/Inputs/def_class.swift
|
|
// RUN: %swift-ide-test -dynamic-lookup-completion -source-filename %s -I=%t > %t.txt
|
|
// RUN: FileCheck %s < %t.txt
|
|
// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.txt
|
|
|
|
import class def_class.MyClass
|
|
|
|
class LocalClass {
|
|
func foo(x : Float) {}
|
|
var magic : ()
|
|
|
|
typealias Invisible = LocalClass
|
|
}
|
|
|
|
var globalVar : Int
|
|
func globalFunc() {}
|
|
|
|
|
|
// CHECK: Begin members
|
|
|
|
// swift.Dictionary<K, V>
|
|
// CHECK-DAG: var elements
|
|
// CHECK-DAG: var size
|
|
// CHECK-DAG: func getBucketCount() -> Int
|
|
// CHECK-DAG: func add(k : KeyType, v : ValueType) -> Bool
|
|
// CHECK-DAG: func find(k : KeyType) -> ValueType?
|
|
// CHECK-DAG: subscript (k : KeyType) -> ValueType
|
|
|
|
// def_class.MyClass
|
|
// CHECK-DAG: func foo(x : Int, y : Int)
|
|
// CHECK-DAG: var bar : Int
|
|
|
|
// LocalClass:
|
|
// CHECK-DAG: func foo(x : Float)
|
|
// CHECK-DAG: var magic : ()
|
|
|
|
// CHECK: End members
|
|
|
|
|
|
// NEGATIVE-NOT: globalVar
|
|
// NEGATIVE-NOT: globalFunc
|
|
// NEGATIVE-NOT: Invisible
|
|
// NEGATIVE-NOT: hiddenFunc
|