giginet / swift-testing-revolutionary

A tool converts test cases written in XCTest to swift-testing
MIT License
200 stars 2 forks source link

Add import of Foundation #8

Closed maartene closed 4 months ago

maartene commented 4 months ago

After conversion, because import XCTest is gone, the compiler can't resolve UUID any more.

Perhaps always importing Foundation if it is not already imported?

Scherm­afbeelding 2024-07-18 om 10 29 08

KR Maarten

giginet commented 4 months ago

Since XCTest depends on Foundation, it seems that importing implicitly imports Foundation as well.

By the way, this code may be broken due to the new feature in the future Swift release. When the new feature, accessLevel import, is enabled, such implicit imports will no longer be allowed. https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md

This code will not be correct in future versions of Swift even if it uses XCTest, so you should probably make the import Foundation explicit yourself.

So I suggest to add import Foundation explicitly.

Thank you.

maartene commented 4 months ago

This makes a lot of sense! Thanks also for the link to the proposal. Getting rid of implicit imports sounds like a good idea.