Navigation Menu

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-12913] Associated type inference crash: "Conflicting type witness deductions" #55359

Closed
dan-zheng opened this issue May 31, 2020 · 2 comments · Fixed by #59357
Closed

[SR-12913] Associated type inference crash: "Conflicting type witness deductions" #55359

dan-zheng opened this issue May 31, 2020 · 2 comments · Fixed by #59357
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself conditional conformances Feature → protocol → conformances: conditional conformances crash Bug: A crash, i.e., an abnormal termination of software

Comments

@dan-zheng
Copy link
Collaborator

Previous ID SR-12913
Radar rdar://problem/63819460
Original Reporter @dan-zheng
Type Bug
Environment

swift-DEVELOPMENT-SNAPSHOT-2020-05-26-a

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, AssociatedTypeInference, CompilerCrash
Assignee None
Priority Medium

md5: 017a8020317d94098be933346fbf2e7d

Issue Description:

Reproducer not minimized. I tried minimizing it to a single file but wasn't yet successful, sorry.

import _Differentiation

protocol DifferentiableCollection: Differentiable & Collection {
  associatedtype TangentVector
}
extension Array: DifferentiableCollection {}
$ swift crash.swift
Assertion failed: (Conformance->getTypeWitnessUncached(assocType) .getWitnessType() ->isEqual(type) && "Conflicting type witness deductions"), function recordTypeWitness, file /Users/danielzheng/swift-debug/swift/lib/Sema/TypeCheckProtocol.cpp, line 2685.
Stack dump:
...
1.  Swift version 5.3-dev (LLVM 2e4f104624, Swift 50b4fcc97d)
2.  While evaluating request TypeCheckSourceFileRequest(source_file "crash.swift")
3.  While type-checking extension of Array (at crash.swift:6:1)
4.  While type-checking protocol conformance to 'DifferentiableCollection' (at crash.swift:3:1) for type 'Array<Element>'
0  swift                    0x000000010a280808 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010a27f788 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x000000010a280dfd SignalHandler(int) + 285
3  libsystem_platform.dylib 0x00007fff6d6115fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338681084448
5  libsystem_c.dylib        0x00007fff6d4e7808 abort + 120
6  libsystem_c.dylib        0x00007fff6d4e6ac6 err + 0
7  swift                    0x000000010a692ab3 swift::ConformanceChecker::recordTypeWitness(swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*) (.cold.1) + 35
8  swift                    0x0000000106a5b881 swift::ConformanceChecker::recordTypeWitness(swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*) + 81
9  swift                    0x0000000106a5c0f0 swift::ConformanceChecker::recordTypeWitness(swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*) + 2240
10 swift                    0x0000000106a5f615 swift::ConformanceChecker::resolveTypeWitnessViaLookup(swift::AssociatedTypeDecl*) + 869
11 swift                    0x0000000106a7f5ea swift::AssociatedTypeInference::solve(swift::ConformanceChecker&) + 282
12 swift                    0x0000000106a7fe1f swift::ConformanceChecker::resolveTypeWitnesses() + 271
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis self-assigned this Jun 7, 2022
@AnthonyLatsis
Copy link
Collaborator

Apparently minimal:

protocol P {
  associatedtype A
}
protocol Q: P {
  associatedtype A
}

struct S<T> {}

extension S: P where T: P {
  typealias A = Int
}
extension S: Q {}

@AnthonyLatsis AnthonyLatsis added conditional conformances Feature → protocol → conformances: conditional conformances and removed associated type inference labels Jun 7, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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 conditional conformances Feature → protocol → conformances: conditional conformances crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
3 participants