moaible
10/31/2017 - 2:34 PM

dump ConventionAnyObjectExample.swift

dump ConventionAnyObjectExample.swift

(source_file
  (import_decl 'Foundation')
  (top_level_code_decl
    (brace_stmt
      (pattern_binding_decl
        (pattern_typed type='@convention(block) () -> Int'
          (pattern_named type='@convention(block) () -> Int' 'a')
          (type_attributed attrs=@convention(block)
            (type_function
              (type_tuple)
              (type_ident
                (component id='Int' bind=Swift.(file).Int))))
        (function_conversion_expr implicit type='@convention(block) () -> Int' location=ConventionAnyObjectExample.swift:3:40 range=[ConventionAnyObjectExample.swift:3:40 - line:3:45]
          (closure_expr type='() -> Int' location=ConventionAnyObjectExample.swift:3:40 range=[ConventionAnyObjectExample.swift:3:40 - line:3:45] discriminator=0 single-expression
            (parameter_list)
            (call_expr implicit type='Int' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] nothrow arg_labels=_builtinIntegerLiteral:
              (constructor_ref_call_expr implicit type='(_MaxBuiltinIntegerType) -> Int' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] nothrow
                (declref_expr implicit type='(Int.Type) -> (_MaxBuiltinIntegerType) -> Int' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] decl=Swift.(file).Int.init(_builtinIntegerLiteral:) function_ref=single)
                (type_expr implicit type='Int.Type' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] typerepr='Int'))
              (tuple_expr implicit type='(_builtinIntegerLiteral: Int2048)' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] names=_builtinIntegerLiteral
                (integer_literal_expr type='Int2048' location=ConventionAnyObjectExample.swift:3:42 range=[ConventionAnyObjectExample.swift:3:42 - line:3:42] value=42))))))
))
  (var_decl "a" type='@convention(block) () -> Int' interface type='@convention(block) () -> Int' access=internal let storage_kind=stored)
  (top_level_code_decl
    (brace_stmt
      (call_expr type='()' location=ConventionAnyObjectExample.swift:4:1 range=[ConventionAnyObjectExample.swift:4:1 - line:4:18] nothrow arg_labels=_:
        (declref_expr type='(Any..., String, String) -> ()' location=ConventionAnyObjectExample.swift:4:1 range=[ConventionAnyObjectExample.swift:4:1 - line:4:1] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
        (tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=ConventionAnyObjectExample.swift:4:7 range=[ConventionAnyObjectExample.swift:4:6 - line:4:18] source_is_scalar elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
          (paren_expr type='Any' location=ConventionAnyObjectExample.swift:4:7 range=[ConventionAnyObjectExample.swift:4:6 - line:4:18]
            (erasure_expr implicit type='Any' location=ConventionAnyObjectExample.swift:4:7 range=[ConventionAnyObjectExample.swift:4:7 - line:4:17]
              (metatype_expr type='(@convention(block) () -> Int).Type' location=ConventionAnyObjectExample.swift:4:7 range=[ConventionAnyObjectExample.swift:4:7 - line:4:17]
                (declref_expr type='@convention(block) () -> Int' location=ConventionAnyObjectExample.swift:4:16 range=[ConventionAnyObjectExample.swift:4:16 - line:4:16] decl=ConventionAnyObjectExample.(file).a@ConventionAnyObjectExample.swift:3:5 direct_to_storage function_ref=unapplied))))))))
  (top_level_code_decl
    (brace_stmt
      (call_expr type='()' location=ConventionAnyObjectExample.swift:5:1 range=[ConventionAnyObjectExample.swift:5:1 - line:5:44] nothrow arg_labels=_:
        (declref_expr type='(Any..., String, String) -> ()' location=ConventionAnyObjectExample.swift:5:1 range=[ConventionAnyObjectExample.swift:5:1 - line:5:1] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
        (tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=ConventionAnyObjectExample.swift:5:24 range=[ConventionAnyObjectExample.swift:5:6 - line:5:44] source_is_scalar elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
          (paren_expr type='Any' location=ConventionAnyObjectExample.swift:5:24 range=[ConventionAnyObjectExample.swift:5:6 - line:5:44]
            (erasure_expr implicit type='Any' location=ConventionAnyObjectExample.swift:5:24 range=[ConventionAnyObjectExample.swift:5:7 - line:5:43]
              (binary_expr type='Bool' location=ConventionAnyObjectExample.swift:5:24 range=[ConventionAnyObjectExample.swift:5:7 - line:5:43] nothrow
                (declref_expr type='(AnyObject?, AnyObject?) -> Bool' location=ConventionAnyObjectExample.swift:5:24 range=[ConventionAnyObjectExample.swift:5:24 - line:5:24] decl=Swift.(file).=== function_ref=unapplied)
                (tuple_expr implicit type='(AnyObject?, AnyObject?)' location=ConventionAnyObjectExample.swift:5:7 range=[ConventionAnyObjectExample.swift:5:7 - line:5:43]
                  (inject_into_optional implicit type='AnyObject?' location=ConventionAnyObjectExample.swift:5:10 range=[ConventionAnyObjectExample.swift:5:7 - line:5:22]
                    (paren_expr type='(AnyObject)' location=ConventionAnyObjectExample.swift:5:10 range=[ConventionAnyObjectExample.swift:5:7 - line:5:22]
                      (coerce_expr type='AnyObject' location=ConventionAnyObjectExample.swift:5:10 range=[ConventionAnyObjectExample.swift:5:8 - line:5:13] writtenType='AnyObject'
                        (call_expr implicit type='AnyObject' location=ConventionAnyObjectExample.swift:5:8 range=[ConventionAnyObjectExample.swift:5:8 - line:5:8] nothrow arg_labels=_:
                          (declref_expr implicit type='(@convention(block) () -> Int) -> AnyObject' decl=Swift.(file)._bridgeAnythingToObjectiveC [with @convention(block) () -> Int] function_ref=single)
                          (paren_expr implicit type='((@convention(block) () -> Int))' location=ConventionAnyObjectExample.swift:5:8 range=[ConventionAnyObjectExample.swift:5:8 - line:5:8]
                            (paren_expr implicit type='(@convention(block) () -> Int)' location=ConventionAnyObjectExample.swift:5:8 range=[ConventionAnyObjectExample.swift:5:8 - line:5:8]
                              (declref_expr type='@convention(block) () -> Int' location=ConventionAnyObjectExample.swift:5:8 range=[ConventionAnyObjectExample.swift:5:8 - line:5:8] decl=ConventionAnyObjectExample.(file).a@ConventionAnyObjectExample.swift:3:5 direct_to_storage function_ref=unapplied)))))))
                  (inject_into_optional implicit type='AnyObject?' location=ConventionAnyObjectExample.swift:5:31 range=[ConventionAnyObjectExample.swift:5:28 - line:5:43]
                    (paren_expr type='(AnyObject)' location=ConventionAnyObjectExample.swift:5:31 range=[ConventionAnyObjectExample.swift:5:28 - line:5:43]
                      (coerce_expr type='AnyObject' location=ConventionAnyObjectExample.swift:5:31 range=[ConventionAnyObjectExample.swift:5:29 - line:5:34] writtenType='AnyObject'
                        (call_expr implicit type='AnyObject' location=ConventionAnyObjectExample.swift:5:29 range=[ConventionAnyObjectExample.swift:5:29 - line:5:29] nothrow arg_labels=_:
                          (declref_expr implicit type='(@convention(block) () -> Int) -> AnyObject' decl=Swift.(file)._bridgeAnythingToObjectiveC [with @convention(block) () -> Int] function_ref=single)
                          (paren_expr implicit type='((@convention(block) () -> Int))' location=ConventionAnyObjectExample.swift:5:29 range=[ConventionAnyObjectExample.swift:5:29 - line:5:29]
                            (paren_expr implicit type='(@convention(block) () -> Int)' location=ConventionAnyObjectExample.swift:5:29 range=[ConventionAnyObjectExample.swift:5:29 - line:5:29]
                              (declref_expr type='@convention(block) () -> Int' location=ConventionAnyObjectExample.swift:5:29 range=[ConventionAnyObjectExample.swift:5:29 - line:5:29] decl=ConventionAnyObjectExample.(file).a@ConventionAnyObjectExample.swift:3:5 direct_to_storage function_ref=unapplied)))))))))))))))
  (top_level_code_decl
    (brace_stmt
      (pattern_binding_decl
        (pattern_typed type='Any'
          (pattern_named type='Any' 'b')
          (type_composite))
        (erasure_expr implicit type='Any' location=ConventionAnyObjectExample.swift:6:14 range=[ConventionAnyObjectExample.swift:6:14 - line:6:14]
          (declref_expr type='@convention(block) () -> Int' location=ConventionAnyObjectExample.swift:6:14 range=[ConventionAnyObjectExample.swift:6:14 - line:6:14] decl=ConventionAnyObjectExample.(file).a@ConventionAnyObjectExample.swift:3:5 direct_to_storage function_ref=unapplied)))
))
  (var_decl "b" type='Any' interface type='Any' access=internal let storage_kind=stored)
  (top_level_code_decl
    (brace_stmt
      (call_expr type='()' location=ConventionAnyObjectExample.swift:7:1 range=[ConventionAnyObjectExample.swift:7:1 - line:7:18] nothrow arg_labels=_:
        (declref_expr type='(Any..., String, String) -> ()' location=ConventionAnyObjectExample.swift:7:1 range=[ConventionAnyObjectExample.swift:7:1 - line:7:1] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
        (tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:6 - line:7:18] source_is_scalar elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
          (paren_expr type='Any' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:6 - line:7:18]
            (open_existential_expr implicit type='Any' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:7 - line:7:7]
              (opaque_value_expr implicit type='(Any).Type' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:7 - line:7:7] @ 0x7fe2b2d075d8)
              (metatype_expr type='Any.Type' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:7 - line:7:17]
                (declref_expr type='Any' location=ConventionAnyObjectExample.swift:7:16 range=[ConventionAnyObjectExample.swift:7:16 - line:7:16] decl=ConventionAnyObjectExample.(file).b@ConventionAnyObjectExample.swift:6:5 direct_to_storage function_ref=unapplied))
              (erasure_expr implicit type='Any' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:7 - line:7:7]
                (opaque_value_expr implicit type='(Any).Type' location=ConventionAnyObjectExample.swift:7:7 range=[ConventionAnyObjectExample.swift:7:7 - line:7:7] @ 0x7fe2b2d075d8))))))))
  (top_level_code_decl
    (brace_stmt
      (call_expr type='()' location=ConventionAnyObjectExample.swift:8:1 range=[ConventionAnyObjectExample.swift:8:1 - line:8:44] nothrow arg_labels=_:
        (declref_expr type='(Any..., String, String) -> ()' location=ConventionAnyObjectExample.swift:8:1 range=[ConventionAnyObjectExample.swift:8:1 - line:8:1] decl=Swift.(file).print(_:separator:terminator:) function_ref=single)
        (tuple_shuffle_expr implicit type='(Any..., separator: String, terminator: String)' location=ConventionAnyObjectExample.swift:8:24 range=[ConventionAnyObjectExample.swift:8:6 - line:8:44] source_is_scalar elements=[-2, -1, -1] variadic_sources=[0] default_args_owner=Swift.(file).print(_:separator:terminator:)
          (paren_expr type='Any' location=ConventionAnyObjectExample.swift:8:24 range=[ConventionAnyObjectExample.swift:8:6 - line:8:44]
            (erasure_expr implicit type='Any' location=ConventionAnyObjectExample.swift:8:24 range=[ConventionAnyObjectExample.swift:8:7 - line:8:43]
              (binary_expr type='Bool' location=ConventionAnyObjectExample.swift:8:24 range=[ConventionAnyObjectExample.swift:8:7 - line:8:43] nothrow
                (declref_expr type='(AnyObject?, AnyObject?) -> Bool' location=ConventionAnyObjectExample.swift:8:24 range=[ConventionAnyObjectExample.swift:8:24 - line:8:24] decl=Swift.(file).=== function_ref=unapplied)
                (tuple_expr implicit type='(AnyObject?, AnyObject?)' location=ConventionAnyObjectExample.swift:8:7 range=[ConventionAnyObjectExample.swift:8:7 - line:8:43]
                  (inject_into_optional implicit type='AnyObject?' location=ConventionAnyObjectExample.swift:8:10 range=[ConventionAnyObjectExample.swift:8:7 - line:8:22]
                    (paren_expr type='(AnyObject)' location=ConventionAnyObjectExample.swift:8:10 range=[ConventionAnyObjectExample.swift:8:7 - line:8:22]
                      (coerce_expr type='AnyObject' location=ConventionAnyObjectExample.swift:8:10 range=[ConventionAnyObjectExample.swift:8:8 - line:8:13] writtenType='AnyObject'
                        (call_expr implicit type='AnyObject' location=ConventionAnyObjectExample.swift:8:8 range=[ConventionAnyObjectExample.swift:8:8 - line:8:8] nothrow arg_labels=_:
                          (declref_expr implicit type='(Any) -> AnyObject' decl=Swift.(file)._bridgeAnythingToObjectiveC [with Any] function_ref=single)
                          (paren_expr implicit type='((Any))' location=ConventionAnyObjectExample.swift:8:8 range=[ConventionAnyObjectExample.swift:8:8 - line:8:8]
                            (paren_expr implicit type='(Any)' location=ConventionAnyObjectExample.swift:8:8 range=[ConventionAnyObjectExample.swift:8:8 - line:8:8]
                              (declref_expr type='Any' location=ConventionAnyObjectExample.swift:8:8 range=[ConventionAnyObjectExample.swift:8:8 - line:8:8] decl=ConventionAnyObjectExample.(file).b@ConventionAnyObjectExample.swift:6:5 direct_to_storage function_ref=unapplied)))))))
                  (inject_into_optional implicit type='AnyObject?' location=ConventionAnyObjectExample.swift:8:31 range=[ConventionAnyObjectExample.swift:8:28 - line:8:43]
                    (paren_expr type='(AnyObject)' location=ConventionAnyObjectExample.swift:8:31 range=[ConventionAnyObjectExample.swift:8:28 - line:8:43]
                      (coerce_expr type='AnyObject' location=ConventionAnyObjectExample.swift:8:31 range=[ConventionAnyObjectExample.swift:8:29 - line:8:34] writtenType='AnyObject'
                        (call_expr implicit type='AnyObject' location=ConventionAnyObjectExample.swift:8:29 range=[ConventionAnyObjectExample.swift:8:29 - line:8:29] nothrow arg_labels=_:
                          (declref_expr implicit type='(Any) -> AnyObject' decl=Swift.(file)._bridgeAnythingToObjectiveC [with Any] function_ref=single)
                          (paren_expr implicit type='((Any))' location=ConventionAnyObjectExample.swift:8:29 range=[ConventionAnyObjectExample.swift:8:29 - line:8:29]
                            (paren_expr implicit type='(Any)' location=ConventionAnyObjectExample.swift:8:29 range=[ConventionAnyObjectExample.swift:8:29 - line:8:29]
                              (declref_expr type='Any' location=ConventionAnyObjectExample.swift:8:29 range=[ConventionAnyObjectExample.swift:8:29 - line:8:29] decl=ConventionAnyObjectExample.(file).b@ConventionAnyObjectExample.swift:6:5 direct_to_storage function_ref=unapplied))))))))))))))))
import Foundation

let a: @convention(block) () -> Int =  { 42 }
print(type(of: a)) // @conversion(block) () -> Int
print((a as AnyObject) === (a as AnyObject)) // true
let b: Any = a
print(type(of: b)) // @conversion(block) () -> Int
print((b as AnyObject) === (b as AnyObject)) // false