[vim/vim] [vim9class] can't import autoload class in another autoload file (Issue #15031)

2 views
Skip to first unread message

Elliot

unread,
Jun 17, 2024, 5:25:57 AM (9 days ago) Jun 17
to vim/vim, Subscribed

Steps to reproduce

tree:

.
├── autoload
│   └── mytest
│       ├── bar
│       │   └── baz.vim
│       └── foo.vim
└── test.vim

autoload/mytest/bar/baz.vim:

vim9script

export class Baz
    def Test(): string
        return "test"
    enddef
endclass

autoload/mytest/foo.vim:

vim9script

import autoload 'mytest/bar/baz.vim'

export def MyTestFoo()
    const instance = baz.Baz.new()
    return instance.Test()
enddef

test.vim:

vim9script

import autoload 'mytest/foo.vim'
import autoload 'mytest/bar/baz.vim'

def NotInAutoload()
    const instance = baz.Baz.new()
    echo "not autoload " .. instance.Test()
enddef

def InAutoload()
    echo "autoload " .. foo.MyTestFoo()
enddef

NotInAutoload() # success

InAutoload() # throw E1048 not found Baz

Expected behaviour

In autoload, import and use another autoloaded class normally.

Version of Vim

9.1.0412

Environment

  • OS: MacOS 14.4.1
  • Term: kitty 0.34.1
  • Shell: fish 3.7.1

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15031@github.com>

Reply all
Reply to author
Forward
0 new messages