Giter Site home page Giter Site logo

[SR-12714] Explicit self. about swift-format HOT 4 CLOSED

apple avatar apple commented on September 24, 2024
[SR-12714] Explicit self.

from swift-format.

Comments (4)

pronebird avatar pronebird commented on September 24, 2024 1

It does not support trimming implicit self either, so would be good to have both options.

from swift-format.

allevato avatar allevato commented on September 24, 2024

Adding or removing explicit self would likely require semantic information about the symbols, not just the syntax, to distinguish identifiers and know whether they're members of self and that the code could be changed without changing its behavior.

It might be possible to approximate it by tracking symbols in their lexical scopes and use that to determine which symbol is being referred to, we wouldn't have access to the compiler Decls that would let us be 100% confident that self is the same as the container for some property x if it's also in the presence of other shadowing names.

from swift-format.

keith avatar keith commented on September 24, 2024

FYI SwiftLint has a semantic version of this https://github.com/realm/SwiftLint/#configuration and SwiftFormat has a best effort version where it inserts and removes only ones it's confident about AFAIUI

from swift-format.

allevato avatar allevato commented on September 24, 2024

Closing this as not planned, since we would need semantic information to do this correctly, and I prefer not to implement a syntax-only version that is incomplete.

from swift-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.