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-390] SIL verifier does not check for protocol conformance in init_existential_metatype instruction #43007

Closed
swift-ci opened this issue Dec 26, 2015 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-390
Radar None
Original Reporter emanuel (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift ba90932591)
Target: x86_64-apple-macosx10.9

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

md5: cfd054e6f203f6977cfa577d07929c19

Issue Description:

Example SIL input:

sil_stage raw

import Builtin
import Swift

class D : A {}

protocol A {}

protocol B {}
  
sil @foo : $(@thick D.Type) -> () {
bb0(%x : $@thick D.Type):
  %mt = metatype $@thick D.Type
  init_existential_metatype %mt : $@thick D.Type, $@thick B.Type
  %res = tuple ()
  return %res : $()
}

sil_vtable D {}

sil_witness_table hidden D: A module conform {}

Steps to reproduce:
sil-opt example.sil

Expected results:
A SIL verifier error explaining that D.Type doesn't conform to B.Type.

Actual results:
SIL accepts and reprints the code without any error.

@slavapestov
Copy link
Member

I fixed this recently:

Slavas-MacBook-Pro:swift slava$ xcrun -sdk macosx $(pwd)/../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/sil-opt example.sil 
example.sil:15:51: error: substitution replacement type 'D' does not conform to protocol 'B'
  init_existential_metatype %mt : $@thick D.Type, $@thick B.Type
                                         

@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