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

Could not cast value of type 'Swift.String' (0x7ff8556a6848) to 'Swift.Dictionary<Swift.String, SourceKittenFramework.SourceKitRepresentable>' (0x7ff855e42708). #1399

Closed
david-hm-morgan opened this issue Sep 17, 2024 · 8 comments · Fixed by #1403

Comments

@david-hm-morgan
Copy link

david-hm-morgan commented Sep 17, 2024

Could not cast value of type 'Swift.String' (0x7ff8556a6848) to 'Swift.Dictionary<Swift.String, SourceKittenFramework.SourceKitRepresentable>' (0x7ff855e42708).

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.

	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/sourcekitten.rb:229:in `run_sourcekitten'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:83:in `block (2 levels) in build'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:81:in `chdir'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:81:in `block in build'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:71:in `map'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:71:in `build'
	from /Users/jenkins/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jazzy-0.15.1/bin/jazzy:16:in `<top (required)>'
	from /Users/jenkins/.rbenv/versions/3.2.2/bin/jazzy:25:in `load'
	from /Users/jenkins/.rbenv/versions/3.2.2/bin/jazzy:25:in `<main>'

Using:

  • Xcode 16.0
  • Sourcekitten 0.36.0
  • rbenv 3.2.2
  • jazzy version: 0.15.1
@johnfairh
Copy link
Collaborator

Please provide some source code that triggers this.

Something in the code is causing SourceKit to return a string for a field that sourcekitten is expecting to be a map.

It's probably a new / unusual construct -- all of our regular test projects run cleanly on Xcode 16 RC1.

@johnfairh johnfairh added the bug label Sep 17, 2024
@david-hm-morgan
Copy link
Author

Hi @johnfairh thanks for responding... strangely (AFAIK) there is nothing new here just rebuilding with latest Xcode, so I am not able to pinpoint which part of the code is triggering this complaint. I'll probably need to narrow down the scope of the doc generation incrementally.
Can jazzy provide more logs as to its progress to get any clues as to where it is when it falls over?

@johnfairh
Copy link
Collaborator

This is the sourcekitten phase crashing. If there's really no per-sourcefile output that you've elided (kind of thing like Parsing SwiftTopLevelClass.swift (1/1)) then that is curious, it looks to me as though it does that printf before starting each file.

@david-hm-morgan
Copy link
Author

a more complete log... 95 files handled apparently correctly, then this error.

...
Parsing OTVAVPlayer.swift (91/95)

Parsing OTVAVPlayerItem+InsightExt.swift (92/95)

Parsing OTVAVPlayerItem.swift (93/95)

Parsing OTVAVURLAsset.swift (94/95)

Parsing OTVSDK.swift (95/95)

Could not cast value of type 'Swift.String' (0x7ff8556a6848) to 'Swift.Dictionary<Swift.String, SourceKittenFramework.SourceKitRepresentable>' (0x7ff855e42708).

@johnfairh
Copy link
Collaborator

Aha ok. So if we're lucky the problem is in OTVSDK.swift. If unlucky (bit suspicious it's the last file...) then it might be in some kind of end-module processing that will need narrowing.

@david-hm-morgan
Copy link
Author

david-hm-morgan commented Sep 17, 2024

The most recent run of this (a few weeks ago) logged some warnings after the 95th file was processed, could the issue now be in this wrap up activity?

...
Parsing OTVSDK.swift (95/95)
WARNING: No documented top-level declarations match name "OTVSSPTokenCallback" specified in categories file
WARNING: No documented top-level declarations match name "AVURLAsset" specified in categories file
WARNING: No documented top-level declarations match name "OTVWatermarkDelegate" specified in categories file
WARNING: No documented top-level declarations match name "OTVWatermarkError" specified in categories file
building site

@johnfairh
Copy link
Collaborator

johnfairh commented Sep 17, 2024

Nope - those WARNINGs are from Jazzy (the ruby layer) after sourcekitten (the swift layer that is now crashing for you) has finished.

@johnfairh
Copy link
Collaborator

Fixed by pulling in a version of sourcekitten that includes the update to parse the new Swift-6 output format.

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

Successfully merging a pull request may close this issue.

2 participants