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

kpm run file order issue #241

Closed
steeling opened this issue Dec 26, 2023 · 4 comments · Fixed by kcl-lang/kcl#1104 or kcl-lang/kcl#1213
Closed

kpm run file order issue #241

steeling opened this issue Dec 26, 2023 · 4 comments · Fixed by kcl-lang/kcl#1104 or kcl-lang/kcl#1213
Assignees

Comments

@steeling
Copy link

Bug Report

1. Minimal reproduce step (Required)

Create the following files in a directory called my_app

my_app/base.k:

schema MyApp:
   name: str
   versions: {str:str}
   version = versions[name]

my_app/input1.k:

output = MyApp{
   name = "my-app"
   versions = my_versions
}

my_app/versions.k:

my_versions = {
   "my-app": "1.0.0"
}

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

This should compile via kpm run my_app. However it can be fixed if we rename my_app/versions.k, so that it lexicographically precedes input1.k:

mv my_app/versions.k my_app/a_versions.k
kpm run my_app

This now succeeds.

3. What did you see instead (Required)

 --> my_app/base.k:4:1
  |
4 |    version = versions[name]
  |  'UndefinedType' object is not subscriptable with 'str'
  |

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

kpm version 0.5.0

@Peefy
Copy link
Contributor

Peefy commented Dec 26, 2023

Related Issue: kcl-lang/kcl#247

@steeling Hi there, thank you for your feedback. We are considering supporting this feature. The internal scope of the configuration block references global scope variables, which are currently not visible.

@satyampsoni
Copy link

is this issue still relevant?

@Peefy
Copy link
Contributor

Peefy commented Jan 23, 2024

is this issue still relevant?

Yes.

@satyampsoni
Copy link

can you please assign me?
@Peefy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants