code: def get_poly_messages() -> Sequence[Message]:
      with Session(engine) as session:
          PolymorphicMessage = with_polymorphic(Message, (UserComment,))
  
          if TYPE_CHECKING:
              # EXPECTED_TYPE: AliasedClass[Message]
              reveal_type(PolymorphicMessage)
  
          poly_query = select(PolymorphicMessage)
  
          if TYPE_CHECKING:
              # EXPECTED_TYPE: Select[Tuple[Message]]
              reveal_type(poly_query)
  
          return session.scalars(poly_query).all()
  
file_path: sqlalchemy/test/typing/plain_files/orm/issue_9340.py
imports: from typing import Sequence
  from typing import TYPE_CHECKING
  from sqlalchemy import create_engine
  from sqlalchemy import select
  from sqlalchemy.orm import DeclarativeBase
  from sqlalchemy.orm import Mapped
  from sqlalchemy.orm import mapped_column
  from sqlalchemy.orm import Session
  from sqlalchemy.orm import with_polymorphic
label_desc: Use image node_id 2 for calling a global function with example usage: get_poly_messages() and returns: session