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

[Bug] Wrong References for the module variable #1734

Open
Peefy opened this issue Nov 4, 2024 · 3 comments
Open

[Bug] Wrong References for the module variable #1734

Peefy opened this issue Nov 4, 2024 · 3 comments
Assignees
Labels
bug Something isn't working lsp resolver

Comments

@Peefy
Copy link
Contributor

Peefy commented Nov 4, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

In the konfig repo https://github.com/kcl-lang/konfig/blob/main/models/kube/frontend/job.k

2. What did you expect to see? (Required)

The right reference list

3. What did you see instead (Required)

image

4. What is your KCL components version? (Required)

v0.10.7

@Peefy Peefy added bug Something isn't working lsp resolver labels Nov 4, 2024
@Peefy Peefy added this to the v0.11.0 Release milestone Nov 4, 2024
@dennybaa
Copy link

dennybaa commented Nov 4, 2024

Possibly this one is related too, running v0.10.7:

import .providers  # module
resources = {
    #                         v
    #                  module
    "providers": providers.installProviders  # [Provider]
    #                              v
    #                        [Provider]
    "vault-config": providers.vaultConfig # error
}
35 |     "vault-config": providers.vaultConfig
   |                     ^ attribute 'vaultConfig' not found in '[Provider]'

Actually resource.providers definition at top of resources uses a locally set providers. From one side it's kinda expected and what it should be, but it used to work before. Please share what the actual future behavior should be?

@dennybaa
Copy link

dennybaa commented Nov 4, 2024

Also, @Peefy please note that 0.10.7 behaves strange with modules, they appear exposed similarly to variables. However this one is unexpected, since the scope for import ... identifiers should be better file only, but not anymore...

  • sub/use_to_config.k (import ..config)
  • sub/main.k (import .config)
.
├── config.k
├── kcl.mod
├── kcl.mod.lock
├── main.k
└── sub
    ├── config.k
    ├── main.k
    └── use_top_config.k

This clashes with

   |
1 | import ..config
  | ^ the name 'config' is defined multiple times, 'config' must be defined only once

@Peefy
Copy link
Contributor Author

Peefy commented Nov 5, 2024

Yes, some recent bug fixes have caused these regression errors. We will fix it later and release it in v0.10.8+ and v0.11.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp resolver
Projects
None yet
Development

No branches or pull requests

3 participants