Brightify / Cuckoo

Boilerplate-free mocking framework for Swift!
MIT License
1.67k stars 176 forks source link

Error when running Cuckoo/run (cuckoo_generator ver. 1.10.2) #465

Closed nanashiki closed 1 year ago

nanashiki commented 1 year ago

overview

$ "Carthage/Checkouts/Cuckoo/run" --download

Script path: /project/Carthage/Checkouts/Cuckoo
No Cuckoo Generator found.
~/project/Carthage/Checkouts/Cuckoo /project
Downloading latest version...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3697  100  3697    0     0   5790      0 --:--:-- --:--:-- --:--:--  5896
Downloading Cuckoo Generator from URL: https://github.com/Brightify/Cuckoo/releases/download/1.10.2/cuckoo_generator
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 9350k  100 9350k    0     0  4110k      0  0:00:02  0:00:02 --:--:-- 9942k

$ Carthage/Checkouts/Cuckoo/run generate ...

...
Swift/StringCharacterView.swift:153: Fatal error: String index is out of bounds
...

No error with Cuckoo Generator 1.10.1.

There are many input files when generating and I do not know which file is not working

Environment

MatyasKriz commented 1 year ago

Hey, @nanashiki, is it possible that the issue is in file Swift/StringCharacterView.swift at line 153? Unless we find out a reproducible use-case, there's not much I can do.

nanashiki commented 1 year ago

StringCharacterView.swift seemed to be an error in the code of apple/swift, not the code we manage https://github.com/apple/swift/blob/main/stdlib/public/core/StringCharacterView.swift

nanashiki commented 1 year ago

minimal code

struct Test {
    var current: Date {
        // 日本語コメント(Japanese Comment)
        Date()
    }
}
nanashiki commented 1 year ago

Crash here https://github.com/Brightify/Cuckoo/blob/e29f10eac6c1fb6fe416d2c0b373848aa1783f56/Generator/Source/Internal/Tokenizer.swift#L190