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

Crash when regenerate changed file #1329

Open
red-beeard opened this issue May 6, 2024 · 1 comment
Open

Crash when regenerate changed file #1329

red-beeard opened this issue May 6, 2024 · 1 comment

Comments

@red-beeard
Copy link

red-beeard commented May 6, 2024

I receive the error Fatal error: String index is out of bounds when using Sourcery with inline generation.

Steps to reproduce:

  1. Edit the file in Xcode.
  2. Save the file (CMD+S).
  3. Trigger file regeneration.

Regeneration does not lead to an error on subsequent attempts.

Version: 2.2.4

sourcery --config .sourcery_without_project.yml --verbose
Using configuration file at '.sourcery_without_project.yml'
Resolving configurations took 0.0075528621673583984
Scanning sources...
	loadOrParse: 0.03952503204345703
	reduce: 0.00018978118896484375
	composer: 0.002712249755859375
	total: 0.04244422912597656
Found 9 types in 7 files, 1 changed from last run.
Files changed:
/Users/red_beeard/Desktop/SourceryParsable/SourceryAutoInit/Models/Episode.swift
Loading templates...
Loaded 3 templates.
	Loading took 0.005421161651611328
Generating code...
Rendering template /Users/red_beeard/Desktop/SourceryParsable/Templates/Sourcery/AutoInitClass.stencil
	Generating AutoInitClass.stencil took 0.009504079818725586
		Processing Ranges took 0.0006799697875976562
Skipping /Users/red_beeard/Desktop/SourceryParsable/SourceryAutoInit/Models/AutoInit/AutoInitClass.generated.swift as it is empty.
Rendering template /Users/red_beeard/Desktop/SourceryParsable/Templates/Sourcery/AutoInitStruct.stencil
	Generating AutoInitStruct.stencil took 0.0031342506408691406
		Processing Ranges took 0.0008521080017089844
Swift/StringUTF16View.swift:678: Fatal error: String index is out of bounds
zsh: illegal hardware instruction  sourcery --config .sourcery_without_project.yml --verbose

This repo reproduce problem. For example:

  1. Open project
  2. Build project (sourcery should be installed in terminal)
  3. Open Episode.swift
  4. Remove one property from struct
  5. Build project or run sourcery from terminal with configuration
@art-divin
Copy link
Collaborator

👏 Wow: thank you very much @red-beeard for the reproducible!

I'll have a look once I have time, but I would also like to welcome anyone to investigate and fix this crash - willing to provide as much support as needed 🤝

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

No branches or pull requests

2 participants