Skip to content

lib/AST/RequirementMachine/Symbol.cpp:81: Assertion `!type->hasUnboundGenericType()' failed #60922

@tayloraswift

Description

@tayloraswift

Describe the bug

the following (invalid) test program crashes the compiler:

enum Selection<Element>
{
    case one(Element)
    case many([Element])
}
extension Selection?
{
}
$ ~/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-30-a/usr/bin/swiftc test.swift
error: compile command failed due to signal 6 (use -v to see invocation)
swift-frontend: /home/build-user/swift/lib/AST/RequirementMachine/Symbol.cpp:81: swift::rewriting::Symbol::Storage::Storage(Symbol::Kind, swift::CanType, ArrayRef<swift::rewriting::Term>): Assertion `!type->hasUnboundGenericType()' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.      Program arguments: /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-30-a/usr/bin/swift-frontend -frontend -c -primary-file test.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -new-driver-path /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-30-a/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-30-a/usr/lib/swift -module-name test -o /tmp/TemporaryDirectory.GFWOdM/test-1.o
1.      Swift version 5.8-dev (LLVM 57827dcce6fa0fb, Swift 04f1cde82e1d1f3)
2.      Compiling with the current language version
3.      While evaluating request TypeCheckSourceFileRequest(source_file "test.swift")
4.      While type-checking extension of Selection? (at test.swift:6:1)
5.      While evaluating request GenericSignatureRequest(extension of Selection?)
6.      While evaluating request InferredGenericSignatureRequest(<Wrapped>, (null), extension of Selection?, {Wrapped == Selection}, {}, 1)

Steps To Reproduce
Steps to reproduce the behavior:

  1. swiftc the given test program, on a recent nightly (i reproduced the crash on DEVELOPMENT-SNAPSHOT-2022-08-18-a and DEVELOPMENT-SNAPSHOT-2022-08-30-a.)

Expected behavior

the compiler should not crash

Environment (please fill out the following information)

  • OS: amazon linux 2
  • swift: DEVELOPMENT-SNAPSHOT-2022-08-30-a

Metadata

Metadata

Assignees

Labels

TypeResolverbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwaregenericsFeature: generic declarations and types

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions