File tree Expand file tree Collapse file tree
src/org/rascalmpl/library/lang
rascal/tests/library/lang/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,11 +160,11 @@ public IValue visitString(Type type) throws IOException {
160160 return vf .string (nextString ());
161161 }
162162
163- @ Override
164- public IValue visitTuple (Type type ) throws IOException {
165- if (isNull ()) {
166- return null ;
167- }
163+ @ Override
164+ public IValue visitTuple (Type type ) throws IOException {
165+ if (isNull ()) {
166+ return null ;
167+ }
168168
169169 List <IValue > l = new ArrayList <>();
170170 in .beginArray ();
@@ -183,7 +183,13 @@ public IValue visitTuple(Type type) throws IOException {
183183 in .endArray ();
184184
185185 // filter all the null values
186- l .removeIf (p -> p == null );
186+ l .forEach (e -> {
187+ if (e == null ) {
188+ throw parseErrorHere ("Tuples can not have null elements." );
189+ }
190+ });
191+
192+ assert type .getArity () == l .size ();
187193
188194 return vf .tuple (l .toArray (new IValue [l .size ()]));
189195 }
Original file line number Diff line number Diff line change @@ -210,7 +210,6 @@ test bool dealWithNull() {
210210
211211 // test different specific nulls for different expected types:
212212 for (t <- defaultJSONNULLValues <0 >) {
213- println (t );
214213 assert parseJSON (t , "null" ) == (defaultJSONNULLValues [t ]?"default-not-found" );
215214 }
216215
You can’t perform that action at this time.
0 commit comments