swiftlang/swift

Missing fixits for missing @dynamicMemberLookup impl

開放

#83,344 建立於 2025年7月25日

 (7 則留言) (0 個反應) (1 位負責人)Swift (10,719 個分叉)batch import
@dynamicMemberLookupattributesbugcompilerdiagnostics qualityfix-itsgood first issueswift 6.2type checker

倉庫指標

星標
 (69,989 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Description

if you haven't implemented the dynamic member lookup requirements the compiler emits an error without fixits:

test.swift:1:1: error: '@dynamicMemberLookup' requires 'Test' to have a 'subscript(dynamicMember:)' method that accepts either 'ExpressibleByStringLiteral' or a key path
1 | @dynamicMemberLookup
  | `- error: '@dynamicMemberLookup' requires 'Test' to have a 'subscript(dynamicMember:)' method that accepts either 'ExpressibleByStringLiteral' or a key path
2 | struct Test {}
3 |

Reproduction

@dynamicMemberLookup
struct Test {}

Expected behavior

fixits with error message

Environment

Apple Swift version 6.2 (swiftlang-6.2.0.13.10 clang-1700.3.13.4) Target: arm64-apple-macosx26.0

Additional information

No response

貢獻者指南