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

Circular Reference Compilation Error when Compiling with Xcode 6.0 Beta Tools #323

Closed
3 tasks done
mikelikespie opened this issue Jun 10, 2024 · 9 comments
Closed
3 tasks done

Comments

@mikelikespie
Copy link
Contributor

Thank you for contributing to MarkdownUI!

Before you submit an issue, please complete the report with all the relevant details for your bug and go through every item in the checklist.

Describe the bug
A clear and concise description of what the bug is.

Checklist

  • I can reproduce this issue with a vanilla SwiftUI project.
  • I can reproduce this issue using the main branch of this package.
  • This bug hasn't been addressed in an existing GitHub issue.

Steps to reproduce

  1. Using the new xcode 6 beta, try building the project or run swift build with new CLI tools selected

Expected behavior
It to build

Screenshots

error: emit-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
/Users/ml/code/swift-markdown-ui/Sources/MarkdownUI/Parser/InlineNode.swift:3:7: note: through reference here
 1 | import Foundation
 2 | 
 3 |  enum InlineNode: Hashable {
   |       |- note: through reference here
   |       |- note: through reference here
   |       `- note: through reference here
 4 |   case text(String)
 5 |   case softBreak
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
/Users/ml/code/swift-markdown-ui/Sources/MarkdownUI/Parser/InlineNode.swift:3:7: note: through reference here
 1 | import Foundation
 2 | 
 3 |  enum InlineNode: Hashable {
   |       |- note: through reference here
   |       |- note: through reference here
   |       `- note: through reference here
 4 |   case text(String)
 5 |   case softBreak
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
/Users/ml/code/swift-markdown-ui/Sources/MarkdownUI/Parser/InlineNode.swift:3:7: note: through reference here
 1 | import Foundation
 2 | 
 3 |  enum InlineNode: Hashable {
   |       |- note: through reference here
   |       |- note: through reference here
   |       `- note: through reference here
 4 |   case text(String)
 5 |   case softBreak

Version information

  • MarkdownUI: c0daf6e
  • OS: macos 14.5 (23F79)
  • Xcode: Version 16.0 beta (16A5171c)

Additional context
Add any other context about the problem here.

@electricsidecar-dev
Copy link

I've submitted FB13830058 to Apple for this bug.

I've isolated the bug down to the following minimally reproducible sample:

indirect enum BlockNode: Hashable {
  case paragraph(content: [InlineNode])
}

indirect enum InlineNode: Hashable {
  case emphasis(children: [InlineNode])
}

@electricsidecar-dev
Copy link

electricsidecar-dev commented Jun 11, 2024

Oddly, the following snippet builds:

indirect enum BlockNode {
  case paragraph(content: InlineNode)
}

indirect enum InlineNode {
  case foo
  case emphasis(children: [InlineNode])
}

but this one does not:

indirect enum BlockNode {
  case paragraph(content: [InlineNode])
}

indirect enum InlineNode {
  case foo
  case emphasis(children: [InlineNode])
}

@electricsidecar-dev
Copy link

More fun: the following builds

indirect enum BlockNode {
  case paragraph([InlineNode])
}

indirect enum InlineNode {
  case foo
  case emphasis(children: [InlineNode])
}

but this does not:

indirect enum BlockNode {
  case paragraph(content: [InlineNode])
}

indirect enum InlineNode {
  case foo
  case emphasis(children: [InlineNode])
}

@electricsidecar-dev
Copy link

I've got a buildable patch working locally. Will send up a PR.

@JoshuaRileyDev
Copy link

How can I reference that PR in Xcode? Or does it need to be approved

@electricsidecar-dev
Copy link

Something like this in your Package.swift should work until this PR is merged:

    dependencies: [
        .package(url: "https://github.com/electricsidecar-dev/swift-markdown-ui.git", .branch("recursive")),
    ],

@gonzalezreal
Copy link
Owner

@electricsidecar-dev Thank you for investigating this and coming up with a workaround. I hope they fix it in the upcoming Xcode 16 betas. Great work! ❤️

@alexsllater
Copy link

please push update

@gonzalezreal
Copy link
Owner

Fixed by #328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants