Repository: apple/swift-syntax (swift)

Issue:
Enable `MemoryLayoutTest` in CI/release builds
`MemoryLayoutTest` is currently only built in debug mode, which means that we don’t test it in CI, where we build swift-syntax in release mode. 

We should also enable it in release mode. The expected memory layout sizes might be different in release mode. In that case, we need to have two different `expected` dictionaries.

Pull request description:
Remove `#if DEBUG` checks for `MemoryLayoutTests` and `SyntaxMemoryLayout`. 

Building and testing it on my local machine with RELEASE config passed without any changes. 

Resolves https://github.com/apple/swift-syntax/issues/2170

Patch:
diff --git a/Sources/SwiftSyntax/MemoryLayout.swift b/Sources/SwiftSyntax/MemoryLayout.swift
index f544e7f9622..501ec8ec220 100644
--- a/Sources/SwiftSyntax/MemoryLayout.swift
+++ b/Sources/SwiftSyntax/MemoryLayout.swift
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#if DEBUG
 // See `MemoryLayoutTest.swift`.
 @_spi(Testing) public enum SyntaxMemoryLayout {
   public struct Value: Equatable {
@@ -41,4 +40,3 @@
     return result
   }
 }
-#endif
diff --git a/Sources/SwiftSyntax/Raw/RawSyntax.swift b/Sources/SwiftSyntax/Raw/RawSyntax.swift
index 9ff39983aa0..e83216ed8bf 100644
--- a/Sources/SwiftSyntax/Raw/RawSyntax.swift
+++ b/Sources/SwiftSyntax/Raw/RawSyntax.swift
@@ -944,7 +944,6 @@ extension RawSyntax: Identifiable {
   }
 }
 
-#if DEBUG
 /// See `SyntaxMemoryLayout`.
 var RawSyntaxDataMemoryLayouts: [String: SyntaxMemoryLayout.Value] = [
   "RawSyntaxData": .init(RawSyntaxData.self),
@@ -953,4 +952,3 @@ var RawSyntaxDataMemoryLayouts: [String: SyntaxMemoryLayout.Value] = [
   "RawSyntaxData.MaterializedToken": .init(RawSyntaxData.MaterializedToken.self),
   "RawSyntax?": .init(RawSyntax?.self),
 ]
-#endif
diff --git a/Sources/SwiftSyntax/Syntax.swift b/Sources/SwiftSyntax/Syntax.swift
index 312d31daade..42df8318698 100644
--- a/Sources/SwiftSyntax/Syntax.swift
+++ b/Sources/SwiftSyntax/Syntax.swift
@@ -308,7 +308,6 @@ extension Syntax {
 @available(*, unavailable, message: "use 'Syntax' instead")
 public struct SyntaxNode {}
 
-#if DEBUG
 /// See `SyntaxMemoryLayout`.
 var SyntaxMemoryLayouts: [String: SyntaxMemoryLayout.Value] = [
   "Syntax": .init(Syntax.self),
@@ -316,4 +315,3 @@ var SyntaxMemoryLayouts: [String: SyntaxMemoryLayout.Value] = [
   "Syntax.Info.Root": .init(Syntax.Info.Root.self),
   "Syntax.Info.NonRoot": .init(Syntax.Info.NonRoot.self),
 ]
-#endif


Test patch:
diff --git a/Tests/SwiftSyntaxTest/MemoryLayoutTest.swift b/Tests/SwiftSyntaxTest/MemoryLayoutTest.swift
index c8e7c64d121..af45e08f7fb 100644
--- a/Tests/SwiftSyntaxTest/MemoryLayoutTest.swift
+++ b/Tests/SwiftSyntaxTest/MemoryLayoutTest.swift
@@ -13,7 +13,6 @@
 @_spi(Testing) import SwiftSyntax
 import XCTest
 
-#if DEBUG
 final class MemoryLayoutTest: XCTestCase {
 
   func testMemoryLayouts() throws {
@@ -46,6 +45,4 @@ final class MemoryLayoutTest: XCTestCase {
       XCTAssertEqual(actualValue, exp.value, "Matching '\(exp.key)' values")
     }
   }
-
 }
-#endif