Open arshiacont opened 1 year ago
This is also FB11427468
/cc @slavapestov
The following reduction attempt does not reach the more descriptive abortion, and hits an immediately preceding assert
instead:
protocol P {
associatedtype A
}
protocol Q {
associatedtype B: P
}
class C1 {}
class C2: C1, P, Q {
typealias A = C2
typealias B = C2
}
class Foo<T: Q> where T == T.B.A, T.B: C1 {}
extension Foo where T == C2 {}
I just checked XCode 14 RC and it seems like it is shipped with this bug... Is there any workaround? Just trying not to ship late for iOS 16 launch! Many thanks in advance, and I'll check in more depth generic news to figure out if there's anyway around.
This note in XCode RC Release seems to be the work around for this issue as well:
That release note is out of date. rdar://91594361 was fixed in beta 3. The bug you're seeing here is a different bug.
rdar://99438489
Thanks @slavapestov for the detail. Strangely adding that flag to XCode makes the code compile/link without any issues! 🤔
Yes that flag also works around this bug too. Is this code example also reduced from Realm-swift?
It is originally from a wrapper for RealmSwift but the code I attached has nothing to do with realmSwift and crashes the 5.7 (XCode 14 RC, without that flag) as standalone.
You can just copy the snippet in a test.swift
and call swift on it from terminal.
The bug is in the 'concrete contraction' pass of the requirement machine, which I need to remove at some point... in the mean time I'll come up with a fix.
The bug is in the 'concrete contraction' pass of the requirement machine, which I need to remove at some point... in the mean time I'll come up with a fix.
When can we expect this fix ?
Hi, do you have any news ?
Not yet, sorry. Does the workaround of building with OTHER_SWIFT_FLAGS=-Xfrontend -requirement-machine-inferred-signatures=off
work for you?
Not yet, sorry. Does the workaround of building with
OTHER_SWIFT_FLAGS=-Xfrontend -requirement-machine-inferred-signatures=off
work for you?
I confirm that the workaround works. We have production code using it.
Not yet, sorry. Does the workaround of building with
OTHER_SWIFT_FLAGS=-Xfrontend -requirement-machine-inferred-signatures=off
work for you?
This workaround does not works for us. We still have this kind of errors with your OTHER_SWIFT_FLAGS value.
Cannot build interface type for term τ_0_1.[Setupable:SetupModel]
Prefix term does not not have a nested type named SetupModel: τ_0_1
Property map entry: τ_0_1 => { layout: AnyObject superclass: [superclass: FaqCell] }
Property map: {
[BaseFAQViewModeling] => { conforms_to: [BaseFAQViewModeling ViewModelling DataSourced FeatureFlipping Featuring UserTyped] }
[BaseFAQViewModeling:Section] => { conforms_to: [SectionModeling] layout: _NativeClass superclass: [superclass: FAQSectionModel] concrete_type: [concrete: FAQSectionModel] }
[Setupable] => { conforms_to: [Setupable] }
[ViewModelling] => { conforms_to: [ViewModelling FeatureFlipping Featuring UserTyped] }
[DataSourced] => { conforms_to: [DataSourced] }
[DataSourced:Section] => { conforms_to: [SectionModeling] }
[FeatureFlipping] => { conforms_to: [FeatureFlipping] }
[Featuring] => { conforms_to: [Featuring] }
[UserTyped] => { conforms_to: [UserTyped] }
[SectionModeling] => { conforms_to: [SectionModeling] }
[SectionModeling:SectionHeaderModel] => { conforms_to: [Nullable] }
[SectionModeling:SectionFooterModel] => { conforms_to: [Nullable] }
[Nullable] => { conforms_to: [Nullable] }
τ_0_0 => { conforms_to: [BaseFAQViewModeling ViewModelling DataSourced FeatureFlipping Featuring UserTyped] }
τ_0_1 => { layout: AnyObject superclass: [superclass: FaqCell] }
τ_0_2 => { conforms_to: [Setupable] layout: AnyObject superclass: [superclass: UIView] }
[BaseFAQViewModeling:Section].[SectionModeling:SectionHeaderModel] => { conforms_to: [Nullable] layout: _NativeClass superclass: [superclass: StringSectionModel] concrete_type: [concrete: StringSectionModel] }
[BaseFAQViewModeling:Section].[SectionModeling:SectionFooterModel] => { conforms_to: [Nullable] concrete_type: [concrete: EmptySectionModel] }
[BaseFAQViewModeling:Section].[SectionModeling:CellModel] => { layout: _NativeClass superclass: [superclass: FaqCellModel] concrete_type: [concrete: FaqCellModel] }
τ_0_1.[Setupable:SetupModel] => { layout: _NativeClass superclass: [superclass: FaqCellModel] concrete_type: [concrete: FaqCellModel] }
τ_0_2.[Setupable:SetupModel] => { layout: _NativeClass superclass: [superclass: StringSectionModel] concrete_type: [concrete: StringSectionModel] }
}
@ThomasD-WL this looks like a different example judging by the protocol names in the debug output. Can you share a test case?
@slavapestov the existing workaround seems to be broken in XCode 14.3 ! The -requirement-machine-signature
flag no longer exists...
Any hints?!
the existing workaround seems to be broken in XCode 14.3
Because the old generics implementation was completely removed in 5.8. The best thing that comes to mind now that switching off the requirement machine is no longer an option is to locate the offending same-type constraint (T == T.RealmType.DomainType
) and either (1) move it to a constructor (seems to work), or (2) replace it with a dynamic check until this issue is resolved. Hopefully Slava has a more seasoned suggestion.
Describe the bug Compiler Crash using Swift 5.7 (XCode 14-Beta6) on the following code snippet. Just run
swift test.swift
(use v5.7 on XCode14-beta6).Steps to reproduce: Compile the attached code using Swift 5.7 - Xcode14-beta6. Compiles fine on 5.6 & before.
Expected behavior The compiler should not crash but emit a diagnostic error.
Code
Environment (please fill out the following information)
Crash Dump