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

Jazzy puts extension func under wrong class #459

Closed
SandyChapman opened this issue Jan 19, 2016 · 7 comments
Closed

Jazzy puts extension func under wrong class #459

SandyChapman opened this issue Jan 19, 2016 · 7 comments

Comments

@SandyChapman
Copy link

Steps to reproduce:

  1. Add the code below into a Swift project.
  2. Run jazzy on the project.
  3. Note that one extension is missing altogether and the other has both of the extension funcs defined under it.
import UIKit

extension UITextView {

    public dynamic var fontPointSize : CGFloat {
        get {
            return self.font!.pointSize
        }
        set {
            self.font = UIFont(name: self.font!.fontName, size: newValue)
        }
    }
}

extension UIView {

    public dynamic var cornerRadius: CGFloat {
        get {
            return self.layer.cornerRadius
        }
        set {
            self.layer.cornerRadius = newValue
            self.layer.masksToBounds = cornerRadius > 0
        }
    }
}

Result:

image

$ jazzy -v
jazzy version: 0.5.0

@SandyChapman
Copy link
Author

Just tested out the SourceKitten output run on this project. Looks like it's properly parsing the output so it's looking like the problem is in the site generator portion of jazzy. See attached file.

source-kitten-output-issue-459.txt

@pcantrell pcantrell self-assigned this Jan 19, 2016
@pcantrell
Copy link
Collaborator

Looks like the problem is that Sourcekitten is outputting the same USR for both extensions, even though it’s distinguishing the names correctly:

    "key.name" : "UITextView",
    "key.typename" : "UITextView.Type",
    "key.usr" : "c:objc(cs)UIView",

vs

    "key.name" : "UIView",
    "key.typename" : "UIView.Type",
    "key.usr" : "c:objc(cs)UIView",

@pcantrell pcantrell assigned jpsim and unassigned pcantrell Jan 19, 2016
@SandyChapman
Copy link
Author

Oh, good catch. I only noticed that key.name was different.

@jpsim
Copy link
Collaborator

jpsim commented Jan 19, 2016

Thanks for reporting this! At first glance, it seems like a bug in Apple's SourceKit.

@pcantrell
Copy link
Collaborator

Any value in merging based on name+USR as a workaround? Or is that just going to introduce more problems?

@jpsim
Copy link
Collaborator

jpsim commented Jan 19, 2016

Any value in merging based on name+USR as a workaround? Or is that just going to introduce more problems?

If our integration specs aren't affected by that, I'd say it's safe enough to try.

pcantrell added a commit to pcantrell/jazzy that referenced this issue Jan 20, 2016
@jpsim
Copy link
Collaborator

jpsim commented Apr 6, 2016

@pcantrell fixed this by working around the issue in 0.6.0.

@jpsim jpsim closed this as completed Apr 6, 2016
@karagraysen karagraysen modified the milestone: The Past Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants