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

ast,fmt: further improve type detection of user defined typenames, extend tests #21004

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Mar 12, 2024

Further improvements so that...

  • a mod.submod.Type specification is automatically formatted

    // ~/.vmodules/foo/foo.v || ~/.vmodules/foo/src/foo.v
    module foo
    
    import bar.baz
    
    type MyAlias = bar.baz.BarBaz
    // Will now be formatted to
    type MyAlias = baz.BarBaz
    // ~/.vmodules/foo/bar/baz/baz.v
    module baz
  • the module (mod.Type[...[]...]) is included in error messages for arrays in generics when using imported datatypes

    current: error: cannot cast struct `BSTree[Result[[]Token, Err[string]]]` to `int`
    update: error: cannot cast struct `datatypes.BSTree[Result[[]Token, Err[string]]]` to `int`
    

    That is uniform with the behavior for imported types in other error messages. E.g.:

    vlib/v/checker/tests/fn_mismatch_option_return_err.vv:4:15: error: cannot use `?time.Duration` as type `time.Duration` in return argument

    vlib/v/checker/tests/import_symbol_private_err.vv:13:6: notice: interface field `io.ReaderWriterImpl.r` must be initialized

@spytheman spytheman merged commit 1e1846f into vlang:master Mar 13, 2024
54 checks passed
@ttytm ttytm deleted the ast/improve-type-detection branch March 13, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants