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

Random orange-ish rectangles #156

Open
b1t-ninja opened this issue Nov 27, 2024 · 1 comment
Open

Random orange-ish rectangles #156

b1t-ninja opened this issue Nov 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@b1t-ninja
Copy link

Describe the bug
When I run freeze file.swift it produces an image which always contains at least one orange-red rectangle that appears in the first 3 lines of code.

Here's an example
freeze

If the file is just 3 lines of code it works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Create .swift file and put
typealias PartOne = @Sendable (String) -> Int
@available(macOS 13.0, *)
let partOne: PartOne = { x in
  let digitPattern = /\d+/ // -- 1
  
  return x.split(separator: "\n").reduce(0) { acc, curr in // -- 2
    let matches = curr.matches(of: digitPattern) // -- 3
    guard let first = Int(matches.first!.0) else { return acc } // -- 3
    
    return acc + first + (matches.count > 1 ? Int(matches.last!.0)! : 0) // -- 4
  }
}

inside
3. run freeze file.swift
4. Tada !

Expected behavior
There should be an output image freeze.png

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.1.1
@bashbunni
Copy link
Member

bashbunni commented Nov 28, 2024

I was able to reproduce this as well on master. I also tested the svg output (freeze file.swift -o freeze.svg) and it didn't have this issue (attached)
swift 1

Will have to take a look at the png conversion under the hood. Thanks for reporting this and providing us with steps to repro!

@bashbunni bashbunni added the bug Something isn't working label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants