Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10962
Merged at revision: 11093
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 248 lines (+118/-14)
13 files modified
ChangeLog (+1/-0)
src/compiler/translator/translator.cpp (+18/-12)
src/diagnostics/diagnostic_en.xml (+23/-1)
src/diagnostics/pregenerated/dict_en.cpp (+6/-1)
test/rbkt/Queries/zorba/xqddf/error_01.spec (+1/-0)
test/rbkt/Queries/zorba/xqddf/error_01.xq (+6/-0)
test/rbkt/Queries/zorba/xqddf/error_01.xqlib (+17/-0)
test/rbkt/Queries/zorba/xqddf/error_02.spec (+1/-0)
test/rbkt/Queries/zorba/xqddf/error_02.xq (+6/-0)
test/rbkt/Queries/zorba/xqddf/error_02.xqlib (+16/-0)
test/rbkt/Queries/zorba/xqddf/error_03.spec (+1/-0)
test/rbkt/Queries/zorba/xqddf/error_03.xq (+6/-0)
test/rbkt/Queries/zorba/xqddf/error_03.xqlib (+16/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+128724@code.launchpad.net

Commit message

Fixed bug #1061222 (bad message for errors in index key type declaration)

Description of the change

Fixed bug #1061222 (bad message for errors in index key type declaration)

To post a comment you must log in.
10962. By Markos Zaharioudakis

Fixed bug #1061222

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2012-10-09T15-04-54.444Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-10-08 12:09:36 +0000
3+++ ChangeLog 2012-10-09 15:01:23 +0000
4@@ -11,6 +11,7 @@
5 * Fixed mustcopyInputNodes() method of no-copy, and jsoniq functions.
6 * Fixed bug #1062093 (bug in var reference iterators with an associated
7 position that is negative)
8+ * Fixed bug #1061222 (bad message for errors in index key type declaration)
9
10
11 version 2.7
12
13=== modified file 'src/compiler/translator/translator.cpp'
14--- src/compiler/translator/translator.cpp 2012-10-09 14:06:08 +0000
15+++ src/compiler/translator/translator.cpp 2012-10-09 15:01:23 +0000
16@@ -4660,7 +4660,8 @@
17 if (!index->isGeneral())
18 {
19 RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
20- ERROR_PARAMS(index->getName()->getStringValue()));
21+ ERROR_PARAMS(index->getName()->getStringValue(),
22+ ZED(ZDST0027_NO_KEY_TYPE_DECL)));
23 }
24 }
25 else
26@@ -4672,7 +4673,17 @@
27 if (!TypeOps::is_subtype(tm, *ptype, *theRTM.ANY_ATOMIC_TYPE_STAR, kloc))
28 {
29 RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
30- ERROR_PARAMS(index->getName()->getStringValue()));
31+ ERROR_PARAMS(index->getName()->getStringValue(),
32+ ZED(ZDST0027_NON_ATOMIC_KEY_TYPE)));
33+ }
34+
35+ if (!index->isGeneral() &&
36+ quant != TypeConstants::QUANT_ONE &&
37+ quant != TypeConstants::QUANT_QUESTION)
38+ {
39+ RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
40+ ERROR_PARAMS(index->getName()->getStringValue(),
41+ ZED(ZDST0027_MULTI_VALUED_KEY_TYPE_DECL)));
42 }
43
44 if (!index->isGeneral() &&
45@@ -4680,15 +4691,8 @@
46 TypeOps::is_equal(tm, *ptype, *theRTM.UNTYPED_ATOMIC_TYPE_ONE, kloc)))
47 {
48 RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
49- ERROR_PARAMS(index->getName()->getStringValue()));
50- }
51-
52- if (!index->isGeneral() &&
53- quant != TypeConstants::QUANT_ONE &&
54- quant != TypeConstants::QUANT_QUESTION)
55- {
56- RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
57- ERROR_PARAMS(index->getName()->getStringValue()));
58+ ERROR_PARAMS(index->getName()->getStringValue(),
59+ ZED(ZDST0027_NON_SPECIFIC_KEY_TYPE_DECL)));
60 }
61
62 if (index->getMethod() == IndexDecl::TREE &&
63@@ -4704,7 +4708,9 @@
64 TypeOps::is_subtype(tm, *ptype, *theRTM.GDAY_TYPE_ONE, kloc)))
65 {
66 RAISE_ERROR(zerr::ZDST0027_INDEX_BAD_KEY_TYPE, kloc,
67- ERROR_PARAMS(index->getName()->getStringValue()));
68+ ERROR_PARAMS(index->getName()->getStringValue(),
69+ ZED(ZDST0027_NON_ORDERED_KEY_TYPE),
70+ ptype->toSchemaString()));
71 }
72
73 keyExpr = wrap_in_type_match(keyExpr,
74
75=== modified file 'src/diagnostics/diagnostic_en.xml'
76--- src/diagnostics/diagnostic_en.xml 2012-10-08 12:09:36 +0000
77+++ src/diagnostics/diagnostic_en.xml 2012-10-09 15:01:23 +0000
78@@ -2257,7 +2257,29 @@
79 </diagnostic>
80
81 <diagnostic code="ZDST0027" name="INDEX_BAD_KEY_TYPE">
82- <value>"$1": index bad key type</value>
83+
84+ <value>"$1": $2</value>
85+
86+ <entry key="NO_KEY_TYPE_DECL">
87+ <value>value index missing key type declaration</value>
88+ </entry>
89+
90+ <entry key="NON_SPECIFIC_KEY_TYPE_DECL">
91+ <value>value index can not have xs:untypedAtomic or xs:anyAtomicType in key type declaration</value>
92+ </entry>
93+
94+ <entry key="MULTI_VALUED_KEY_TYPE_DECL">
95+ <value>value index can not have a key type declaration with * or + quantifier</value>
96+ </entry>
97+
98+ <entry key="NON_ATOMIC_KEY_TYPE">
99+ <value>index has non-atomic key type declaration</value>
100+ </entry>
101+
102+ <entry key="NON_ORDERED_KEY_TYPE">
103+ <value>range index can not have type $3 in key type declaration</value>
104+ </entry>
105+
106 </diagnostic>
107
108 <diagnostic code="ZDST0028" name="INDEX_NOT_DETERMINISTIC">
109
110=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
111--- src/diagnostics/pregenerated/dict_en.cpp 2012-10-08 12:09:36 +0000
112+++ src/diagnostics/pregenerated/dict_en.cpp 2012-10-09 15:01:23 +0000
113@@ -387,7 +387,7 @@
114 { "ZDST0024", "index multiple property values" },
115 { "ZDST0025", "\"$1\": index cannot be declared as unique" },
116 { "ZDST0026", "index invalid property value" },
117- { "ZDST0027", "\"$1\": index bad key type" },
118+ { "ZDST0027", "\"$1\": $2" },
119 { "ZDST0028", "\"$1\": index not deterministic" },
120 { "ZDST0029", "\"$1\": index invalid data source" },
121 { "ZDST0030", "\"$1\": index non-constant data source" },
122@@ -887,6 +887,11 @@
123 { "~XUST0001_UDF_2", "\"$2\": function declared simple but body is updating" },
124 { "~XUST0002_Transform", "transform expression witn non-updating or vacuous modify clause" },
125 { "~XUST0002_UDF_2", "\"$2\": function declared updating but body is not updating or vacuous" },
126+ { "~ZDST0027_MULTI_VALUED_KEY_TYPE_DECL", "value index can not have a key type declaration with * or + quantifier" },
127+ { "~ZDST0027_NON_ATOMIC_KEY_TYPE", "index has non-atomic key type declaration" },
128+ { "~ZDST0027_NON_ORDERED_KEY_TYPE", "range index can not have type $3 in key type declaration" },
129+ { "~ZDST0027_NON_SPECIFIC_KEY_TYPE_DECL", "value index can not have xs:untypedAtomic or xs:anyAtomicType in key type declaration" },
130+ { "~ZDST0027_NO_KEY_TYPE_DECL", "value index missing key type declaration" },
131 { "~ZDST0060_unknown_localname", "unknown localname ($3)" },
132 { "~ZDST0060_unknown_namespace", "unknown namespace ($3)" },
133 { "~ZWST0005_PARAM_TYPE", "type of parameter $3 is $4 which is not a subtype of xs:anyAtomicType" },
134
135=== added file 'test/rbkt/Queries/zorba/xqddf/error_01.spec'
136--- test/rbkt/Queries/zorba/xqddf/error_01.spec 1970-01-01 00:00:00 +0000
137+++ test/rbkt/Queries/zorba/xqddf/error_01.spec 2012-10-09 15:01:23 +0000
138@@ -0,0 +1,1 @@
139+Error: http://www.zorba-xquery.com/errors:ZDST0027
140
141=== added file 'test/rbkt/Queries/zorba/xqddf/error_01.xq'
142--- test/rbkt/Queries/zorba/xqddf/error_01.xq 1970-01-01 00:00:00 +0000
143+++ test/rbkt/Queries/zorba/xqddf/error_01.xq 2012-10-09 15:01:23 +0000
144@@ -0,0 +1,6 @@
145+import module namespace error = "http://www.example.com/error" at "error_01.xqlib";
146+
147+declare namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
148+
149+
150+ddl:create($error:collection);
151
152=== added file 'test/rbkt/Queries/zorba/xqddf/error_01.xqlib'
153--- test/rbkt/Queries/zorba/xqddf/error_01.xqlib 1970-01-01 00:00:00 +0000
154+++ test/rbkt/Queries/zorba/xqddf/error_01.xqlib 2012-10-09 15:01:23 +0000
155@@ -0,0 +1,17 @@
156+
157+module namespace error = "http://www.example.com/error";
158+
159+declare namespace an = "http://www.zorba-xquery.com/annotations";
160+
161+
162+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
163+
164+
165+declare collection error:collection as node()*;
166+
167+declare variable $error:coll := xs:QName("error:collection");
168+
169+
170+declare %an:automatic %an:value-equality index error:index
171+on nodes dml:collection(xs:QName("error:collection"))
172+by string(@id);
173
174=== added file 'test/rbkt/Queries/zorba/xqddf/error_02.spec'
175--- test/rbkt/Queries/zorba/xqddf/error_02.spec 1970-01-01 00:00:00 +0000
176+++ test/rbkt/Queries/zorba/xqddf/error_02.spec 2012-10-09 15:01:23 +0000
177@@ -0,0 +1,1 @@
178+Error: http://www.zorba-xquery.com/errors:ZDST0027
179
180=== added file 'test/rbkt/Queries/zorba/xqddf/error_02.xq'
181--- test/rbkt/Queries/zorba/xqddf/error_02.xq 1970-01-01 00:00:00 +0000
182+++ test/rbkt/Queries/zorba/xqddf/error_02.xq 2012-10-09 15:01:23 +0000
183@@ -0,0 +1,6 @@
184+import module namespace error = "http://www.example.com/error" at "error_02.xqlib";
185+
186+declare namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
187+
188+
189+ddl:create($error:collection);
190
191=== added file 'test/rbkt/Queries/zorba/xqddf/error_02.xqlib'
192--- test/rbkt/Queries/zorba/xqddf/error_02.xqlib 1970-01-01 00:00:00 +0000
193+++ test/rbkt/Queries/zorba/xqddf/error_02.xqlib 2012-10-09 15:01:23 +0000
194@@ -0,0 +1,16 @@
195+module namespace error = "http://www.example.com/error";
196+
197+declare namespace an = "http://www.zorba-xquery.com/annotations";
198+
199+
200+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
201+
202+
203+declare collection error:collection as node()*;
204+
205+declare variable $error:coll := xs:QName("error:collection");
206+
207+
208+declare %an:automatic %an:value-range index error:index
209+on nodes dml:collection(xs:QName("error:collection"))
210+by xs:hexBinary(@id) as xs:hexBinary;
211
212=== added file 'test/rbkt/Queries/zorba/xqddf/error_03.spec'
213--- test/rbkt/Queries/zorba/xqddf/error_03.spec 1970-01-01 00:00:00 +0000
214+++ test/rbkt/Queries/zorba/xqddf/error_03.spec 2012-10-09 15:01:23 +0000
215@@ -0,0 +1,1 @@
216+Error: http://www.zorba-xquery.com/errors:ZDST0027
217
218=== added file 'test/rbkt/Queries/zorba/xqddf/error_03.xq'
219--- test/rbkt/Queries/zorba/xqddf/error_03.xq 1970-01-01 00:00:00 +0000
220+++ test/rbkt/Queries/zorba/xqddf/error_03.xq 2012-10-09 15:01:23 +0000
221@@ -0,0 +1,6 @@
222+import module namespace error = "http://www.example.com/error" at "error_03.xqlib";
223+
224+declare namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
225+
226+
227+ddl:create($error:collection);
228
229=== added file 'test/rbkt/Queries/zorba/xqddf/error_03.xqlib'
230--- test/rbkt/Queries/zorba/xqddf/error_03.xqlib 1970-01-01 00:00:00 +0000
231+++ test/rbkt/Queries/zorba/xqddf/error_03.xqlib 2012-10-09 15:01:23 +0000
232@@ -0,0 +1,16 @@
233+module namespace error = "http://www.example.com/error";
234+
235+declare namespace an = "http://www.zorba-xquery.com/annotations";
236+
237+
238+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
239+
240+
241+declare collection error:collection as node()*;
242+
243+declare variable $error:coll := xs:QName("error:collection");
244+
245+
246+declare %an:automatic %an:value-equality index error:index
247+on nodes dml:collection(xs:QName("error:collection"))
248+by @id as xs:untypedAtomic;

Subscribers

People subscribed via source and target branches