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

贡献者指南