Skip to content
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

[SR-13117] Assertion failure on checking protocol conformance for IUO #55563

Closed
typesanitizer opened this issue Jun 29, 2020 · 3 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@typesanitizer
Copy link

Previous ID SR-13117
Radar None
Original Reporter @typesanitizer
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 8d32e59948351de84a54a6fe551defd6

Issue Description:

Consider the following example:

struct S<T> : Codable {
  var s: [T]!
}

Compiling with Jun 25 master @ 43fd786, this hits an assertion failure

Assertion failed: (!type->hasArchetype() && "already have a contextual type"), function mapTypeIntoContext, file /Users/varun/foss-swift/swift/lib/AST/GenericEnvironment.cpp, line 87.
Stack dump:
0.      Program arguments: /Users/varun/foss-swift/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift-frontend -frontend -c -primary-file tmp.swift -target x86_64-apple-darwin19.5.0 -enable-objc-interop -color-diagnostics -module-name tmp -o /var/folders/9t/dn6p4v392nb8c8cwxfyxc84c0000gn/T/tmp-3621f0.o
1.      Swift version 5.3-dev (LLVM f9957f081870012, Swift 43fd786ae08cf97)
2.      While evaluating request TypeCheckSourceFileRequest(source_file "tmp.swift")
3.      While type-checking 'S' (at tmp.swift:1:1)
4.      While evaluating request ResolveImplicitMemberRequest(tmp.(file).S@tmp.swift:1:8, resolve CodingKeys)
5.      While type-checking protocol conformance to 'Decodable' (in module 'Swift') for type 'S<T>' (declared at [tmp.swift:1:1 - line:3:1] RangeText="struct S<T>: Codable {
    var x: [T]!
")
0  swift-frontend           0x000000010cf003a5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x000000010ceff378 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000010cf00986 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff6d8b55fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338678315552
5  libsystem_c.dylib        0x00007fff6d78b808 abort + 120
6  libsystem_c.dylib        0x00007fff6d78aac6 err + 0
7  swift-frontend           0x000000010d3f3a91 swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) (.cold.2) + 33
8  swift-frontend           0x0000000109b2a6f9 swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) + 73
9  swift-frontend           0x00000001096da5ba varConformsToCodable(swift::DeclContext*, swift::VarDecl*, swift::ProtocolDecl*) + 74
10 swift-frontend           0x00000001096d9493 canSynthesize(swift::DerivedConformance&, swift::ValueDecl*) + 3507
11 swift-frontend           0x00000001096d9dfb swift::DerivedConformance::deriveDecodable(swift::ValueDecl*) + 379
12 swift-frontend           0x00000001097bd38b swift::TypeChecker::deriveProtocolRequirement(swift::DeclContext*, swift::NominalTypeDecl*, swift::ValueDecl*) + 443
13 swift-frontend           0x00000001097bd0d5 swift::ConformanceChecker::resolveWitnessViaDerivation(swift::ValueDecl*) + 149
14 swift-frontend           0x00000001097be223 swift::ConformanceChecker::resolveValueWitnesses() + 371
15 swift-frontend           0x00000001097b8cb5 swift::ConformanceChecker::checkConformance(swift::MissingWitnessDiagnosisKind) + 245
@typesanitizer
Copy link
Author

@swift-ci create

@slavapestov
Copy link
Member

Nice catch! Looks like an easy fix.

@slavapestov
Copy link
Member

#32611

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants