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

Allow using imported types in other types within the same file #8708

Merged

Commits on Nov 15, 2022

  1. Allow using imported types in other types within the same file

    In the test case (from issue vimeo#7116) both the type definition and the
    import of the typed lived in the same file. This caused `OpeningTypes`
    to be an `InlineTypeAlias` instead of a `LinkableTypeAlias`, in turn
    causing an 'Invalid type alias' exception[^1].
    
    By replacing the array union (+) with an array_merge, the import of the
    type overrides the initial type declaration within the `Main` class.
    This means type imports within one file act more like they would when in
    separate files.
    
    Fixes vimeo#7116
    
    [^1]: [src/Psalm/Type/Atomic.php:407](https://github.com/vimeo/psalm/blob/1986c8b4a8018b1819bc4b83b0f7e69c2c936792/src/Psalm/Type/Atomic.php#L407)
    annervisser committed Nov 15, 2022
    Copy the full SHA
    d10b1f9 View commit details
    Browse the repository at this point in the history