Skip to content

Commit

Permalink
fix: fix schema instances in multiple kcl mods. (#637)
Browse files Browse the repository at this point in the history
* fix: fix schema instances in multiple kcl mods.

* fix: fix failed test cases and move 'Entries' to 'kclvm-parser'.

* fix: fix CR comments.

* fix: make fmt

* fix: fix win test case.

* fix: fix win doc test case.
  • Loading branch information
zong-zhe committed Aug 3, 2023
1 parent c88eadf commit 4227210
Show file tree
Hide file tree
Showing 75 changed files with 908 additions and 208 deletions.
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_1/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 1
k1_inst:
- id: 1
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_1/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kcl_cli_configs:
file:
- ./main.k
- ./main1.k
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_1/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K1 {
id: 1
}
5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_1/main1.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema K1:
id: int

k1_inst = K1.instances()

4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_2/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 2
k2_inst:
- id: 2
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_2/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kcl_cli_configs:
file:
- ./main.k
- ./sub/main.k
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_2/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K2 {
id: 2
}
5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_2/sub/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema K2:
id: int

k2_inst = K2.instances()

4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 3
k3_inst:
- id: 3
5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "kcl3"
edition = "0.0.1"
version = "0.0.1"

5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kcl_cli_configs:
file:
- ./main.k
- ./sub/main.k
- ./main1.k
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K3 {
id: 3
}
1 change: 1 addition & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/main1.k
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k3_inst = K3.instances()
2 changes: 2 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_3/sub/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema K3:
id: int
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_4/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 4
k4_inst:
- id: 4
6 changes: 6 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_4/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kcl_cli_configs:
file:
- ./test_inst_41/main.k
- ${test_inst_42:KCL_MOD}/main.k
package_maps:
test_inst_42: ./src/test_data/instances/test_inst_4/test_inst_42
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_41"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K4 {
id: 4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_42"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema K4:
id: int

k4_inst = K4.instances()

5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_5/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a:
id: 5
b: 5
k5_inst:
- id: 5
8 changes: 8 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_5/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kcl_cli_configs:
file:
- ./test_inst_51/
- ${test_inst_52:KCL_MOD}/main.k
- ${test_inst_53:KCL_MOD}/main.k
package_maps:
test_inst_52: ./src/test_data/instances/test_inst_5/test_inst_52
test_inst_53: ./src/test_data/instances/test_inst_5/test_inst_53
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_51"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K5 {
id: 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b = 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_52"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema K5:
id: int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_53"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k5_inst = K5.instances()
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_6/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 6
k6_inst:
- id: 6
8 changes: 8 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_6/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kcl_cli_configs:
file:
- ${test_inst_61:KCL_MOD}/main.k
- ./test_inst_62/
- ${test_inst_63:KCL_MOD}/main.k
package_maps:
test_inst_61: ./src/test_data/instances/test_inst_6/test_inst_61
test_inst_63: ./src/test_data/instances/test_inst_6/test_inst_63
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_51"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K6 {
id: 6
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_52"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema K6:
id: int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_53"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k6_inst = K6.instances()
4 changes: 4 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_7/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:
id: 7
k7_inst:
- id: 7
8 changes: 8 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_7/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kcl_cli_configs:
file:
- ${test_inst_71:KCL_MOD}/main.k
- ${test_inst_72:KCL_MOD}/main.k
- ./test_inst_73/
package_maps:
test_inst_71: ./src/test_data/instances/test_inst_7/test_inst_71
test_inst_72: ./src/test_data/instances/test_inst_7/test_inst_72
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_51"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K7 {
id: 7
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_52"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema K7:
id: int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_53"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k7_inst = K7.instances()
17 changes: 17 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
a:
id: 8
b:
id: 81
c:
id: 82
k8_inst_1:
- id: 8
- id: 81
- id: 82
d:
id: 83
k8_inst_2:
- id: 8
- id: 81
- id: 82
- id: 83
5 changes: 5 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_8"
edition = "0.0.1"
version = "0.0.1"

14 changes: 14 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/kcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kcl_cli_configs:
file:
- ${test_inst_81:KCL_MOD}/main.k
- ./main.k
- ${test_inst_82:KCL_MOD}/main.k
- ./main1.k
- ${test_inst_83:KCL_MOD}/main.k
- ./main2.k
- ${test_inst_84:KCL_MOD}/main.k
package_maps:
test_inst_81: ./src/test_data/instances/test_inst_8/test_inst_81
test_inst_82: ./src/test_data/instances/test_inst_8/test_inst_82
test_inst_83: ./src/test_data/instances/test_inst_8/test_inst_83
test_inst_84: ./src/test_data/instances/test_inst_8/test_inst_84
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
b = K8 {
id: 81
}
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/main1.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
c = K8 {
id: 82
}
3 changes: 3 additions & 0 deletions kclvm/cmd/src/test_data/instances/test_inst_8/main2.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
d = K8 {
id: 83
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_51"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = K8 {
id: 8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_52"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema K8:
id: int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_53"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k8_inst_1 = K8.instances()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_inst_53"
edition = "0.0.1"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k8_inst_2 = K8.instances()
Loading

0 comments on commit 4227210

Please sign in to comment.