Published property wrapper with method or property with the same crashes the compiler

Originator:matej.jirasek
Number:rdar://FB7688576 Date Originated:04-05-2020
Status:Open Resolved:No
Product:Swift Compiler Product Version:5.2
Classification:Application Crash Reproducible:Always
 
Please describe the issue:

When I’ve been rewriting code from completion handlers to ObservableObject I crashed the compiler, seg fault 11 is the result.

- It only happens for the @Published property
- @State property is fine and the compiler throws an error “Invalid redeclaration of ***”
- Other (custom) property wrappers work fine too and throw proper human readable error.

Tools:

- Xcode Version 11.4.1 (11E503a)

Please list the steps you took to reproduce the issue:

Just try to build the attached project and a set fault is thrown.

If it is Xcode project instead fo the package it behaves the same.

What did you expect to happen?

Proper human readable error in the form “Invalid redeclaration of ***”

What actually happened?

Compiler crash.

Minimal code required to reproduce this:

```
import Combine

class NumberObservableObject: ObservableObject {

    @Published var number: Int = 0

    func number() {}
}
```

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!