Skip to content

Conversation

@rintaro
Copy link
Member

@rintaro rintaro commented Nov 14, 2023

(Continuation from #68892)

ASTGen always builds with the host Swift compiler, without requiring bootstrapping, and is enabled in more places. Move the regex literal parsing logic there so it is enabled in more host environments, and makes use of CMake's Swift support. Enable all of the regex literal tests when ASTGen is built, to ensure everything is working.

Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources, because they are no longer needed.

@rintaro
Copy link
Member Author

rintaro commented Nov 14, 2023

@swift-ci Please smoke test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/Parse already depends on ASTGen (e.g. swift_ASTGen_buildTopLevelASTNodes) Instead of injecting the function, just use the @_cdecl function in ASTGen

@rintaro
Copy link
Member Author

rintaro commented Nov 14, 2023

@swift-ci Please smoke tests

@rintaro
Copy link
Member Author

rintaro commented Nov 14, 2023

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Nov 15, 2023

1 similar comment
@rintaro
Copy link
Member Author

rintaro commented Nov 16, 2023

@compnerd
Copy link
Member

C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift-experimental-string-processing\Sources\_RegexParser\Regex\Parse\SourceLocation.swift:136:19: error: cannot specialize non-generic type 'Source.LocatedError'
    return Source.LocatedError<Self>(self, loc)
                  ^           ~~~~~~
                              

error: fatalError

@rintaro
Copy link
Member Author

rintaro commented Nov 16, 2023

@compnerd
Copy link
Member

Failed Tests (3):
  Swift(windows-x86_64) :: StringProcessing/Parse/regex.swift
  Swift(windows-x86_64) :: StringProcessing/Parse/regex_parse_end_of_buffer.swift
  Swift(windows-x86_64) :: StringProcessing/Parse/regex_parse_error.swift

ASTGen always builds with the host Swift compiler, without requiring
bootstrapping, and is enabled in more places. Move the regex literal
parsing logic there so it is enabled in more host environments, and
makes use of CMake's Swift support. Enable all of the regex literal
tests when ASTGen is built, to ensure everything is working.

Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources,
because they are no longer needed.
swiftrt.obj is required for making things work
@rintaro
Copy link
Member Author

rintaro commented Nov 16, 2023

@swift-ci Please smoke test

@rintaro rintaro marked this pull request as ready for review November 16, 2023 21:37
@rintaro rintaro merged commit 66e4487 into swiftlang:main Nov 16, 2023
@finagolfin
Copy link
Member

This pull broke a test on the Android AArch64 CI, which doesn't have a host Swift compiler so it does a full bootstrap, ie not building the swift-syntax parser and now regex literals after this pull:

FAIL: Swift(android-aarch64) :: SourceKit/Sema/sema_regex.swift (8100 of 17117)
******************** TEST 'Swift(android-aarch64) :: SourceKit/Sema/sema_regex.swift' FAILED ********************
Script:
--
: 'RUN: at line 6';   /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/buildbot_linux/swift-linux-x86_64/bin/sourcekitd-test -module-cache-path '/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache' -req=sema /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift -- /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift -Xfrontend -enable-bare-slash-regex -Xfrontend -disable-availability-checking | /usr/bin/python3.10 /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/utils/PathSanitizingFileCheck --allow-unused-prefixes --sanitize BUILD_DIR=/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/buildbot_linux/swift-linux-x86_64 --sanitize SOURCE_DIR=/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift --use-filecheck /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/buildbot_linux/llvm-linux-x86_64/bin/FileCheck  /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift
--
Exit Code: 1

Command Output (stderr):
--
{
  key.request: source.request.editor.open,
  key.name: "/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift",
  key.compilerargs: [
    "-module-cache-path",
    "/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/buildbot_linux/swift-linux-x86_64/swift-test-results/aarch64-unknown-linux-android/clang-module-cache",
    "/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift",
    "-Xfrontend",
    "-enable-bare-slash-regex",
    "-Xfrontend",
    "-disable-availability-checking"
  ],
  key.sourcefile: "/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift",
  key.primary_file: "/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift"
}
/home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift:24:15: error: CHECK-NOT: excluded string found in input
// CHECK-NOT: key.severity:
              ^
<stdin>:20:2: note: found here
 key.severity: source.diagnostic.severity.error,
 ^~~~~~~~~~~~~

Input file: <stdin>
Check file: /home/ubuntu/jenkins/workspace/oss-swift-RA-linux-ubuntu-16.04-android-arm64/swift/test/SourceKit/Sema/sema_regex.swift

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        .
        .
        .
       15: [ 
       16:  { 
       17:  key.line: 2, 
       18:  key.column: 3, 
       19:  key.filepath: "SOURCE_DIR/test/SourceKit/Sema/sema_regex.swift", 
       20:  key.severity: source.diagnostic.severity.error, 
not:24      !~~~~~~~~~~~~                                    error: no match expected
       21:  key.id: "use_nonmatching_operator", 
       22:  key.description: "'/' is not a prefix unary operator", 
       23:  key.diagnostic_stage: source.diagnostic.stage.swift.sema 
       24:  }, 
       25:  { 
        .
        .
        .
>>>>>>

The issue is that this test requires swift_in_compiler, which is always defined unless bootstrapping is completely turned off. Previously, regex literals were still built in the full bootstrapping mode, but after this pull, they no longer are, so the features associated with swift_in_compiler have now changed. This will affect any platform that doesn't have a host Swift compiler, not just the Android CI.

bnbarham added a commit to bnbarham/swift that referenced this pull request Nov 28, 2023
This test was missed in swiftlang#69838. Update to depend on swift_swift_parser
(ie. "have a host Swift compiler").
bnbarham added a commit to bnbarham/swift that referenced this pull request Nov 28, 2023
This test was missed in swiftlang#69838. Update to depend on swift_swift_parser
(ie. "have a host Swift compiler").
@DougGregor
Copy link
Member

This test should be using swift_swift_parser, which is covered by #70073.

However, in the near future we're going to require a Swift compiler on the host to build the Swift compiler, with "full bootstrap" going away entirely, so that we can fully switch over to (e.g.) the new Swift parser and driver, and remove the C++ implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants