From f92f697b32ccea7d0af292adaa070760a8befa39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 26 Aug 2016 13:06:10 -0400 Subject: [PATCH 1/3] frontend/serialization: fix skipping type check for `nullable Object` attr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- src/frontend/serialization_phase.nit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/serialization_phase.nit b/src/frontend/serialization_phase.nit index 6633e139ad..b9cab9d4a4 100644 --- a/src/frontend/serialization_phase.nit +++ b/src/frontend/serialization_phase.nit @@ -310,7 +310,7 @@ do if type_name == "nullable Object" then # Don't type check code.add """ - var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}") + self.{{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}") """ else code.add """ var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}") From 1a3f6ef98ad0e4bf0cfeb7a14cb36d327fe80212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 26 Aug 2016 13:10:41 -0400 Subject: [PATCH 2/3] binary::serialization: fix if condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/binary/serialization.nit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/binary/serialization.nit b/lib/binary/serialization.nit index fff7fb5482..f4228b371b 100644 --- a/lib/binary/serialization.nit +++ b/lib/binary/serialization.nit @@ -178,7 +178,7 @@ class BinaryDeserializer # An invalid attribute name is an heuristic for invalid data. # Hitting an object end marker will result in an empty string. - assert next_attribute_name.is_valid_id else + if not next_attribute_name.is_valid_id then var error if next_attribute_name.is_empty then From 6f6377079e66575c5cae4d04629eab859cf572f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 26 Aug 2016 13:03:17 -0400 Subject: [PATCH 3/3] lib/serialization: better doc for `AttributeTypeError` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/serialization/serialization.nit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/serialization/serialization.nit b/lib/serialization/serialization.nit index 7ecc7d2f45..5630b34acd 100644 --- a/lib/serialization/serialization.nit +++ b/lib/serialization/serialization.nit @@ -148,7 +148,7 @@ abstract class Deserializer var errors = new Array[Error] end -# Deserialization got wrong attribute names +# Error on invalid dynamic type for a deserialized attribute class AttributeTypeError super Error