You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gotyanov opened this issue
Aug 23, 2020
· 1 comment
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
protocolContainerType{associatedtypeParentvarparent:Parent{get}}@dynamicMemberLookupstructContext<Container:ContainerType>{letcontainer:Container
subscript<T>(dynamicMember keyPath:KeyPath<Context<Container.Parent>,T>)->T{Context<Container.Parent>(container: container.parent)[keyPath: keyPath]}}structNotContainer{letvalue=42}structContainerImpl:ContainerType{letparent=NotContainer()}// uncomment next line to get a crash with "Illegal instuction: 4" message// print(Context(container: ContainerImpl()).value)
Type Context<Container.Parent> is invalid because Context has a constraint on Container – this type must conform to ContainerType protocol, but Container.Parent does not conform to it.
Unfortunately this code compiles, unless your uncomment last line.
Expected result – Context<Container.Parent> usage should cause an error "Type 'Container.Parent' does not conform to protocol 'ContainerType'"
The text was updated successfully, but these errors were encountered:
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Environment
XCode 12
Additional Detail from JIRA
md5: 3c0b1f24cebd97971d4eb7d0b56236ae
Issue Description:
Type Context<Container.Parent> is invalid because Context has a constraint on Container – this type must conform to ContainerType protocol, but Container.Parent does not conform to it.
Unfortunately this code compiles, unless your uncomment last line.
Expected result – Context<Container.Parent> usage should cause an error "Type 'Container.Parent' does not conform to protocol 'ContainerType'"
The text was updated successfully, but these errors were encountered: