Comments (8)
The --someany false option is just to prevent the rule replacing cases where T is untyped. To disable the rule altogether, use --disable opaqueGenericParameters
from swiftformat.
@tciuro OK, it's not a bug so much as a missing feature - right now opaqueGenericParameters
doesn't apply to protocol methods. I'm not sure there's any good reason why it shouldn't but it would be a fairly big refactor to make that work so I'm going to treat it as a feature request.
from swiftformat.
Ahh, this isn't applied to protocol requirements right now because protocol methods don't have a body?
I think updating this to apply to protocol should be a safe change. This compiles, which makes sense because the two syntaxes have the same meaning:
protocol PusherManagerSubscriber {
func newEventHasArrived(with object: some Codable)
}
struct MyType: PusherManagerSubscriber {
func newEventHasArrived<T: Codable>(with object: T) {
print(object)
}
}
from swiftformat.
And it's interesting that it didn't change this one:
protocol PusherManagerSubscriber {
var id: UUID { get }
func newEventHasArrived<T: Codable>(with object: T)
}
it should have been updated with this, right?
protocol PusherManagerSubscriber {
var id: UUID { get }
func newEventHasArrived(with object: some Codable)
}
from swiftformat.
And it's interesting that it didn't change this one:
That might be a bug. I'll investigate.
from swiftformat.
Ah, cool. Thanks Nick!
from swiftformat.
@calda can you see any potential problems with applying opaqueGenericParameters
to protocol methods (besides implementation trickiness)?
from swiftformat.
Thanks for looking into this, Nick!
from swiftformat.
Related Issues (20)
- Swift Package Manager Xcode Command Plugin does not works on 0.52.9 and later HOT 10
- add `length then alpha` option to `--sortImports` HOT 1
- Computed property `set` is being formatted to `self.set` HOT 2
- Inheriting rules in a subdirectory HOT 2
- Error with conditionalAssignment HOT 3
- Reindent comments HOT 1
- contribution questions HOT 2
- Private Properties At The Top Of Class Definition HOT 1
- Extension of Internal struct cannot be public HOT 3
- `preferForLoop` rule causes build error HOT 4
- Duplicate header generated HOT 1
- Question about Wrap HOT 5
- trying to access ObservedObject of parent class requires explicit self. SwiftFormat removes it HOT 3
- --anonymousforeach ignore is not working HOT 2
- Bug with unusedArguments rule HOT 1
- When using extensions, it disrupts Xcode's bookmark information.
- trailingClosures or trailingclosures HOT 1
- `--xcodeindentation` seems not working HOT 1
- Enable `swiftformat:sort` globally? HOT 2
- Internal keyword is dropped on access-level imports (AccessLevelOnImport feature) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftformat.