Commit 97cbf7e
committed
cmd/cue: actually drop unsupported Go std types in
The Go logic fell through if altType returned nil,
meaning that we would try to generate and import Go std packages
as if they were CUE std packages, which does not work at all.
While here, move the extractor fields to clarify that pkg and consts
are per-package and not per-file, and declare a pkg variable which
simplifies the named type logic a bit and lets us see that a nil check
further down was redundant.
Some Go standard library packages may declare a structure
which can be imported as CUE correctly, and our thinking is that they
could be generated under a non-CUE-std namespace like
cue.mod/gen/pkg.go.dev/reflect rather than cue.mod/gen/reflect.
That is left for a future change in the form of TODOs in both
the testscript, which includes two such examples, and the code.
Fixes #648.
Signed-off-by: Daniel Martí <[email protected]>
Change-Id: Ic2bd39a2024c76449978c44ae70dc75b65297314
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1210516
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>get go
1 parent 9a53c81 commit 97cbf7e
2 files changed
+35
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
257 | | - | |
258 | | - | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
1040 | 1040 | | |
1041 | 1041 | | |
1042 | 1042 | | |
1043 | | - | |
| 1043 | + | |
| 1044 | + | |
1044 | 1045 | | |
1045 | 1046 | | |
1046 | 1047 | | |
1047 | 1048 | | |
1048 | | - | |
1049 | | - | |
| 1049 | + | |
| 1050 | + | |
1050 | 1051 | | |
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | 1055 | | |
1055 | 1056 | | |
1056 | 1057 | | |
1057 | | - | |
| 1058 | + | |
1058 | 1059 | | |
1059 | 1060 | | |
1060 | 1061 | | |
| |||
1072 | 1073 | | |
1073 | 1074 | | |
1074 | 1075 | | |
1075 | | - | |
| 1076 | + | |
1076 | 1077 | | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1083 | 1088 | | |
1084 | 1089 | | |
1085 | 1090 | | |
| 1091 | + | |
1086 | 1092 | | |
1087 | 1093 | | |
1088 | 1094 | | |
1089 | 1095 | | |
1090 | | - | |
| 1096 | + | |
1091 | 1097 | | |
1092 | 1098 | | |
1093 | 1099 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 60 | | |
66 | 61 | | |
67 | | - | |
| 62 | + | |
68 | 63 | | |
69 | 64 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
73 | 69 | | |
74 | 70 | | |
75 | 71 | | |
76 | | - | |
| 72 | + | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
80 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
81 | 79 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
0 commit comments