Skip to content

Failing unit tests on main #1410

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

Closed
TiagoMaiaL opened this issue Mar 15, 2023 · 4 comments
Closed

Failing unit tests on main #1410

TiagoMaiaL opened this issue Mar 15, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@TiagoMaiaL
Copy link
Contributor

Description

For some reason some unit tests are failing for me on the main branch. They are:

  • ClosureExprTests.testClosureExpr():
testClosureExpr(): failed - Actual output (+) differed from expected output (-):
–{area in
+{areaimport
 }
  • DoStmtTests.testDoStmt():
testDoStmt(): failed - Actual output (+) differed from expected output (-):
–do {
–    try a.b()
+distributed {
+    truea.b()
 } catch Error1, Error2 {
     print("Known error")
–} catch Error3 where error.isError4 {
–    throw Error4.error3
+} catch Error3weakerror.isError4 {
+    targetError4.error3
 } catch {
     print(error)
 }
  • DoStmtTests.testDoStmtWithExclamationMark():
testDoStmtWithExclamationMark(): failed - Actual output (+) differed from expected output (-):
–do {
–    try! a.b()
+distributed {
+    true! a.b()
 } catch Error1, Error2 {
     print("Known error")
–} catch Error3 where error.isError4 {
–    throw Error4.error3
+} catch Error3weakerror.isError4 {
+    targetError4.error3
 } catch {
     print(error)
 }
  • DoStmtTests.testDoStmtWithPostfixQuestionMark():
testDoStmtWithPostfixQuestionMark(): failed - Actual output (+) differed from expected output (-):
–do {
–    try? a.b()
+distributed {
+    true? a.b()
 } catch Error1, Error2 {
     print("Known error")
–} catch Error3 where error.isError4 {
–    throw Error4.error3
+} catch Error3weakerror.isError4 {
+    targetError4.error3
 } catch {
     print(error)
 }
  • EnumCaseElementTests.testEnumInit:
testEnumInit(): failed - Actual output (+) differed from expected output (-):
–␣enum Greeting: String, Codable, Equatable {
+␣else Greeting: String, Codable, Equatable {
     case goodMorning = "Good Morning", helloWorld = "Hello World", hi
 }
  • ImportTests.testImport:
testImport(): failed - Actual output (+) differed from expected output (-):
–␣import SwiftSyntax
+␣if SwiftSyntax
  • SwiftTests.testSwitch:
testSwitch(): failed - Actual output (+) differed from expected output (-):
–switch count {
+swiftcount {
 case 1:
     print(count)
 case 2:
     print(count)
 default:
     break
 }

Steps to Reproduce

This happens to me whenever I run all tests using Xcode, with the SwiftSyntax-Package scheme selected.

Some specifications on my machine:

  • Xcode 14.0.1 (I'm not using any different toolchain)
  • MacOS Ventura 13.0
  • Apple M1 Pro
@TiagoMaiaL TiagoMaiaL added the bug Something isn't working label Mar 15, 2023
@ahoppen
Copy link
Member

ahoppen commented Mar 15, 2023

rdar://106733216

@ahoppen
Copy link
Member

ahoppen commented Mar 16, 2023

Hey @TiagoMaiaL,
Could you try if the issue still reproduces for you after cleaning the build (Product -> Clean Build Folder). I’ve seen similar issues before when one of the enums that is marked as @frozen is modified. Really those shouldn’t be marked as @frozen but we needed to to work around some miscompile if the host toolchain is Swift 5.5.

@TiagoMaiaL
Copy link
Contributor Author

Hey, @ahoppen. I'm not seeing these errors anymore. I'm closing this issue.

@ahoppen
Copy link
Member

ahoppen commented Mar 22, 2023

I think the issue here is the current misuse of the @frozen attribute to work around a Swift 5.5 compiler bug. Should you see it again, clean the build directory and rebuild.

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