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-5022] Accepts-invalid: polymorphic use of non-required initializer #47598
Comments
On master, with assertions on:
|
@swift-ci create |
The generated code is trying to call a class method that does not exist (' #A.init!allocator.1'): sil @_T04main1PPA2A1ACRbzAaBRzlExSi1y_tcfC : $@convention(method) <Self where Self : A, Self : P> (Int, @thick Self.Type) -> @owned Self {
// %0 // users: %6, %3
// %1 // user: %4
bb0(%0 : $Int, %1 : $@thick Self.Type):
%2 = alloc_stack $Self, var, name "self" // users: %8, %9
debug_value %0 : $Int, let, name "y", argno 1 // id: %3
%4 = upcast %1 : $@thick Self.Type to $@thick A.Type // users: %6, %5
%5 = class_method %4 : $@thick A.Type, #A.init!allocator.1 : (A.Type) -> (Int) -> A, $@convention(method) (Int, @thick A.Type) -> @owned A // user: %6
%6 = apply %5(%0, %4) : $@convention(method) (Int, @thick A.Type) -> @owned A // user: %7
%7 = unchecked_ref_cast %6 : $A to $Self // users: %10, %8
store %7 to %2 : $*Self // id: %8
dealloc_stack %2 : $*Self // id: %9
return %7 : $Self // id: %10
} // end sil function '_T04main1PPA2A1ACRbzAaBRzlExSi1y_tcfC'
sil_vtable A {
#A.init!initializer.1: (A.Type) -> (Int) -> A : _T04main1ACACSi1x_tcfc // A.init(x:)
#A.deinit!deallocator: _T04main1ACfD // A.__deallocating_deinit
} |
The code is invalid, because the call to the non-required initializer should not type check. Of course it shouldn't crash; the fix would be to emit a proper diagnostic, and not proceed to IRGen. |
AnthonyLatsis
added
the
crash
Bug: A crash, i.e., an abnormal termination of software
label
Dec 12, 2022
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
macOS 10.12.5
Xcode 8.3.2
Additional Detail from JIRA
md5: 0b580fd9a0aee060409a581f4093589c
Issue Description:
When trying to run this:
I got this error:
The text was updated successfully, but these errors were encountered: