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.
76 lines
3.2 KiB
Swift
76 lines
3.2 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: cp %s %t/main.swift
|
|
// RUN: %target-swift-frontend -disable-fine-grained-dependencies -typecheck -primary-file %t/main.swift %S/Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps
|
|
|
|
// Check that the output is deterministic.
|
|
// RUN: %target-swift-frontend -disable-fine-grained-dependencies -typecheck -primary-file %t/main.swift %S/Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps
|
|
// RUN: diff %t.swiftdeps %t-2.swiftdeps
|
|
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL-NEGATIVE %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER-NEGATIVE %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL-NEGATIVE %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER %s < %t.swiftdeps
|
|
// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER-NEGATIVE %s < %t.swiftdeps
|
|
|
|
|
|
// PROVIDES-NOMINAL-LABEL: {{^provides-nominal:$}}
|
|
// PROVIDES-NOMINAL-NEGATIVE-LABEL: {{^provides-nominal:$}}
|
|
// PROVIDES-MEMBER-LABEL: {{^provides-member:$}}
|
|
// PROVIDES-MEMBER-NEGATIVE-LABEL: {{^provides-member:$}}
|
|
// DEPENDS-NOMINAL-LABEL: {{^depends-nominal:$}}
|
|
// DEPENDS-NOMINAL-NEGATIVE-LABEL: {{^depends-nominal:$}}
|
|
// DEPENDS-MEMBER-LABEL: {{^depends-member:$}}
|
|
// DEPENDS-MEMBER-NEGATIVE-LABEL: {{^depends-member:$}}
|
|
|
|
// PROVIDES-NOMINAL-DAG: 4BaseC"
|
|
class Base {
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}4BaseC", ""]
|
|
// PROVIDES-MEMBER-NEGATIVE-NOT: - ["{{.+}}4BaseC", "{{.+}}"]
|
|
func foo() {}
|
|
}
|
|
|
|
// PROVIDES-NOMINAL-DAG: 3SubC"
|
|
// DEPENDS-NOMINAL-DAG: 9OtherBaseC"
|
|
class Sub : OtherBase {
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}3SubC", ""]
|
|
// PROVIDES-MEMBER-NEGATIVE-NOT: - ["{{.+}}3SubC", "{{.+}}"]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}9OtherBaseC", ""]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}9OtherBaseC", "foo"]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}9OtherBaseC", "init"]
|
|
func foo() {}
|
|
}
|
|
|
|
// PROVIDES-NOMINAL-DAG: 9SomeProtoP"
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}9SomeProtoP", ""]
|
|
protocol SomeProto {}
|
|
|
|
// PROVIDES-NOMINAL-DAG: 10OtherClassC"
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}10OtherClassC", ""]
|
|
// DEPENDS-NOMINAL-DAG: 10OtherClassC"
|
|
// DEPENDS-NOMINAL-DAG: 9SomeProtoP"
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}9SomeProtoP", ""]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}10OtherClassC", ""]
|
|
extension OtherClass : SomeProto {}
|
|
|
|
// PROVIDES-NOMINAL-NEGATIVE-NOT: 11OtherStructV"{{$}}
|
|
// DEPENDS-NOMINAL-DAG: 11OtherStructV"
|
|
extension OtherStruct {
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}11OtherStructV", ""]
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}11OtherStructV", "foo"]
|
|
// PROVIDES-MEMBER-DAG: - ["{{.+}}11OtherStructV", "bar"]
|
|
// PROVIDES-MEMBER-NEGATIVE-NOT: "baz"
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}11OtherStructV", "foo"]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}11OtherStructV", "bar"]
|
|
// DEPENDS-MEMBER-DAG: - !private ["{{.+}}11OtherStructV", "baz"]
|
|
// DEPENDS-MEMBER-DAG: - ["{{.+}}11OtherStructV", ""]
|
|
func foo() {}
|
|
var bar: () { return () }
|
|
private func baz() {}
|
|
}
|
|
|
|
// PROVIDES-NOMINAL-NEGATIVE-LABEL: {{^depends-nominal:$}}
|
|
// PROVIDES-MEMBER-NEGATIVE-LABEL: {{^depends-member:$}}
|