Skip to content

Type aliases can cause unneccesary file info to be included in errors #3519

@MeGaGiGaGon

Description

@MeGaGiGaGon

Summary

https://play.ty.dev/41a8e2da-82d3-4fd2-9255-c3757780e51b

from typing import Callable
from dataclasses import dataclass

@dataclass
class Box[T]:
    item: T

type RefBox[T] = Box[T]

def transmute_inner[T, V](x: RefBox[T]) -> RefBox[V]:
    # Expected: Return type does not match returned value: expected `RefBox[V@transmute_inner]`, found `RefBox[T@transmute_inner]`
    # Actual: Return type does not match returned value: expected `main.RefBox @ main.py:8:6[V@transmute_inner]`, found `main.RefBox @ main.py:8:6[T@transmute_inner]` 
    return x

Version

ty 0.0.35 (bc12d1c 2026-05-10) playground 7efc9a6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiagnosticsRelated to reporting of diagnostics.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions