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

Can't document - -= / /= operators #808

Closed
1 of 2 tasks
leif-ibsen opened this issue Jan 21, 2024 · 8 comments
Closed
1 of 2 tasks

Can't document - -= / /= operators #808

leif-ibsen opened this issue Jan 21, 2024 · 8 comments
Labels
duplicate This issue or pull request already exists

Comments

@leif-ibsen
Copy link

Description

I'm trying to use DocC to document a Swift big integer package 'BigInt'.

I'm using Xcode 15.2 (15C500b).

The package main structure is called 'BInt'. It implements among other things the overloaded operators

& &= | |= ^ ^= ~ + += - -= * *= / /= % %= ** == != < > <= >= << <<= >> >>=

The BInt extension file organizes the layout of the documentation and it works as expected
for all the operators, except for

- -= / /=

For - and -= Xcode suggests suffixes to resolve the overload ambiguity,
but later claims that the selected function does not exist.

For / and /= Xcode doesn't recognize / and /= as operators.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

That the operators

- -= / /=

behave like the other operators with respect to documentation.

Actual behavior

Skærmbillede 2024-01-21 kl  11 41 15Skærmbillede 2024-01-21 kl  11 43 07Skærmbillede 2024-01-21 kl  12 45 19

Steps To Reproduce

No response

Swift-DocC Version Information

No response

Swift Compiler Version Information

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: x86_64-apple-macosx14.0
@leif-ibsen leif-ibsen added the bug Something isn't working label Jan 21, 2024
@d-ronnqvist
Copy link
Contributor

This issue has previously been reported in #714 and fixed in #717 and #739. Both those PRs have also been cherry-picked into the 5.10 release in #750 and #772.

Please check with the latest main or the 5.10 release to see if there are any other bugs with linking to operators still impacting that project and reopen this issue with more information if there are any.

@d-ronnqvist d-ronnqvist added duplicate This issue or pull request already exists and removed bug Something isn't working labels Jan 22, 2024
@leif-ibsen
Copy link
Author

I'm afraid I can't figure out how to download and install release 5.10.

I guess it will be in the next Xcode release, so I'll have to wait for that.

@d-ronnqvist
Copy link
Contributor

d-ronnqvist commented Jan 22, 2024

You can download a 5.10 toolchain for Xcode from swift.org/download/. After you run the installer you can change toolchains from the Xcode > Toolchains menu.

Screenshot 2024-01-22 at 14 05 57

This menu group is only visible when you have one or more custom toolchains installed.

@leif-ibsen
Copy link
Author

I tried, and now it all seems to work. Thank you

@leif-ibsen
Copy link
Author

Just one more question. When I use toolchain 5.10 in Xcode everything works,
but when I execute the command line command

swift package --disable-sandbox preview-documentation --taget BigInt

to build the documentation, the problem is still there,
so it seems that the old toolchain is used.

How can I force toolchain 5.10 to be used in this situation?

@d-ronnqvist
Copy link
Contributor

Yes, the toolchain setting in Xcode only applies to Xcode. You can pass a --toolchain argument to the swift CLI to use a custom toolchain. For example:

swift package \
 --toolchain /Users/YOUR_USERNAME/Library/Developer/Toolchains/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a.xctoolchain \
 --disable-sandbox \
 preview-documentation \
 --target BigInt

@leif-ibsen
Copy link
Author

It works, thank you.
It seems that the --disable-sandbox argument must come first, though.

@leif-ibsen
Copy link
Author

Sorry to bother you again, but although everything looks fine when generating documentation in Xcode
with the 'Build Documentation' command, there are still problems when trying to publish to GitHub Pages.

I made a small test package DocCTest with the operators

- -= / /= % %= << <<= >> >>=

and tried to preview the documentation with the command

swift package --toolchain /Library/Developer/Toolchains/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-25-a.xctoolchain
--disable-sandbox preview-documentation --target DocCTest --port 8082

and it gave me the following warnings

/Users/leifibsen/Documents/SwiftXcode/DocCTest/Sources/DocCTest/DocCTest.docc/Extensions/BIntExt.md:19:5: warning: Can't resolve '(::)-3woeb'
/Users/leifibsen/Documents/SwiftXcode/DocCTest/Sources/DocCTest/DocCTest.docc/Extensions/BIntExt.md:20:5: warning: Can't resolve '(::)-2wsf1'
/Users/leifibsen/Documents/SwiftXcode/DocCTest/Sources/DocCTest/DocCTest.docc/Extensions/BIntExt.md:21:5: warning: Can't resolve '=(::)'

but it was still possible to see all operators in the preview.

I then published to GitHub Pages with the command

swift package --toolchain /Library/Developer/Toolchains/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-25-a.xctoolchain
--allow-writing-to-directory ./docs generate-documentation --target DocCTest
--disable-indexing --transform-for-static-hosting --hosting-base-path DocCTest --output-path ./docs

You can see the result at

https://leif-ibsen.github.io/DocCTest/documentation/docctest

Clicking one of the operators % %= << <<= >> >>= gives

The page you're looking for can't be found.

although it works in the preview.

I wonder what is wrong?

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants