mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Convert most of the name lookup requests and a few other ancillary typechecking requests into dependency sinks. Some requests are also combined sinks and sources in order to emulate the current scheme, which performs scope changes based on lookup flags. This is generally undesirable, since it means those requests cannot immediately be generalized to a purely context-based scheme because they depend on some client-provided entropy source. In particular, the few callers that are providing the "known private" name lookup flag need to be converted to perform lookups in the appropriate private context. Clients that are passing "no known dependency" are currently considered universally incorrect and are outside the scope of the compatibility guarantees. This means that request-based dependency tracking registers strictly more edges than manual dependency tracking. It also means that once we fixup the clients that are passing "known private", we can completely remove these name lookup flags. Finally, some tests had to change to accomodate the new scheme. Currently, we go out of our way to register a dependency edge for extensions that declare protocol conformances. However, we were also asserting in at least one test that extensions without protocol conformances weren't registering dependency edges. This is blatantly incorrect and has been undone now that the request-based scheme is automatically registering this edge.
68 lines
3.6 KiB
Swift
68 lines
3.6 KiB
Swift
// REQUIRES: shell
|
|
// Also uses awk:
|
|
// XFAIL OS=windows
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: cp %s %t/main.swift
|
|
|
|
// Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled
|
|
// RUN: %target-swift-frontend -enable-fine-grained-dependencies -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps
|
|
|
|
// RUN: %target-swift-frontend -enable-fine-grained-dependencies -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps
|
|
// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t.swiftdeps >%t-processed.swiftdeps
|
|
// RUN: %S/../Inputs/process_fine_grained_swiftdeps.sh <%t-2.swiftdeps >%t-2-processed.swiftdeps
|
|
|
|
// RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps
|
|
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL %s < %t-processed.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL-2 %s < %t-processed.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER %s < %t-processed.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER-NEGATIVE %s < %t-processed.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL %s < %t-processed.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER %s < %t-processed.swiftdeps
|
|
|
|
// PROVIDES-NOMINAL-DAG: nominal implementation 4main4BaseC '' true
|
|
// PROVIDES-NOMINAL-DAG: nominal interface 4main4BaseC '' true
|
|
class Base {
|
|
// PROVIDES-MEMBER-DAG: potentialMember implementation 4main4BaseC '' true
|
|
// PROVIDES-MEMBER-DAG: potentialMember interface 4main4BaseC '' true
|
|
// PROVIDES-MEMBER-NEGATIVE-NOT: member {{.*}} 4main4BaseC {{[^']]+}} true
|
|
func foo() {}
|
|
}
|
|
|
|
// PROVIDES-NOMINAL-DAG: nominal implementation 4main3SubC '' true
|
|
// PROVIDES-NOMINAL-DAG: nominal interface 4main3SubC '' true
|
|
// DEPENDS-NOMINAL-DAG: nominal interface 4main9OtherBaseC '' false
|
|
class Sub : OtherBase {
|
|
// PROVIDES-MEMBER-DAG: potentialMember implementation 4main3SubC '' true
|
|
// PROVIDES-MEMBER-NEGATIVE-NOT: {{potentialM|m}}}}ember implementation 4main3SubC {{.+}} true
|
|
// DEPENDS-MEMBER-DAG: potentialMember interface 4main9OtherBaseC '' false
|
|
// DEPENDS-MEMBER-DAG: member interface 4main9OtherBaseC foo false
|
|
// DEPENDS-MEMBER-DAG: member interface 4main9OtherBaseC init false
|
|
func foo() {}
|
|
}
|
|
|
|
// PROVIDES-NOMINAL-DAG: nominal implementation 4main9SomeProtoP '' true
|
|
// PROVIDES-NOMINAL-DAG: nominal interface 4main9SomeProtoP '' true
|
|
// PROVIDES-MEMBER-DAG: potentialMember interface 4main9SomeProtoP '' true
|
|
protocol SomeProto {}
|
|
|
|
// PROVIDES-NOMINAL-DAG: nominal implementation 4main10OtherClassC '' true
|
|
// PROVIDES-NOMINAL-2-DAG: nominal interface 4main10OtherClassC '' true
|
|
// PROVIDES-MEMBER-DAG: potentialMember interface 4main10OtherClassC '' true
|
|
// DEPENDS-MEMBER-DAG: potentialMember interface 4main10OtherClassC '' true
|
|
extension OtherClass : SomeProto {}
|
|
|
|
// PROVIDES-NOMINAL-DAG: nominal implementation 4main11OtherStructV '' true
|
|
// PROVIDES-NOMINAL-DAG: nominal interface 4main11OtherStructV '' true
|
|
extension OtherStruct {
|
|
// PROVIDES-MEMBER-DAG: potentialMember interface 4main11OtherStructV '' true
|
|
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV foo true
|
|
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV bar true
|
|
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV baz true
|
|
// DEPENDS-MEMBER-DAG: potentialMember interface 4main11OtherStructV '' true
|
|
func foo() {}
|
|
var bar: () { return () }
|
|
private func baz() {}
|
|
}
|