Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14475] mistyping willSet as willset leads to confusing diagnostic #56831

Open
ZevEisenberg opened this issue Apr 12, 2021 · 1 comment
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. parser Area → compiler: The legacy C++ parser

Comments

@ZevEisenberg
Copy link
Contributor

Previous ID SR-14475
Radar rdar://problem/76546622
Original Reporter @ZevEisenberg
Type Bug
Environment

Xcode 12.5 (12E5244e) on macOS 11.2.3 (20D91)

Apple Swift version 5.4 (swiftlang-1205.0.26.4 clang-1205.0.19.54)
Target: arm64-apple-darwin20.3.0

(There's a similar error using Xcode 12.4.)

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, Parser
Assignee None
Priority Medium

md5: 569b2c90e0becb673376a3effaea699f

Issue Description:

struct Model: Codable {}


class Controller {
    private var model: Model = Model() {
        willset { // this should be willSet (capital S)
            print("will set")
        }
        didSet {
            print("new value is \(self)")
        }
    }
} 

This produces the following diagnostic when compiled on the command line:

$ swift /Users/igeek/Desktop/BadError.swift
/Users/igeek/Desktop/BadError.swift:4:40: error: trailing closure passed to parameter of type 'Decoder' that does not accept a closure
    private var model: Model = Model() {
                                       ^
BadError.Model (internal):3:14: note: 'init(from:)' declared here
    internal init(from decoder: Decoder) throws
             ^
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants