Skip to content

Periphery doesn't account for various uses of propertiesΒ #998

@rgoldberg

Description

@rgoldberg

Describe the bug

Periphery doesn't account for various uses of properties.

Reproduction

1: When a property is used as a key for a Dictionary:

import Foundation

struct Thing {
	let path: String
}

let thing = Thing(path: "/dev/null")

var thingByPath = [String:Thing]()
thingByPath[thing.path] = thing

for path in thingByPath.keys {
	do {
		try FileManager.default.attributesOfItem(atPath: path)
		print(1)
	} catch {
		print(2)
	}
}

2: When a property is indirectly used like in an implicit use in String(describing:), either directly or via a call to print(_:separator:terminator:):

struct Thing {
	let id: Int
	let name: String
}

print(Thing(id: 1, name: "a"))

Environment

$ periphery version
3.2.0

$ swift -version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0

$ xcodebuild -version
Xcode 26.1.1
Build version 17B100

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions