Browse Source

Multiple fixes for #155. Added more than 300 fuzzy new test.

Marco Bambini 8 years ago
parent
commit
a58675e0a8
100 changed files with 929 additions and 33 deletions
  1. 9 1
      src/cli/unittest.c
  2. 10 6
      src/compiler/gravity_codegen.c
  3. 4 0
      src/compiler/gravity_lexer.c
  4. 35 3
      src/compiler/gravity_parser.c
  5. 73 14
      src/compiler/gravity_semacheck2.c
  6. 2 0
      src/compiler/gravity_symboltable.c
  7. 14 6
      src/runtime/gravity_core.c
  8. 3 2
      src/runtime/gravity_vm.c
  9. 1 1
      src/shared/gravity_value.c
  10. 22 0
      test/fuzzy/2017-04-25/id:000000,sig:11,src:000035,op:havoc,rep:2.gravity
  11. BIN
      test/fuzzy/2017-04-25/id:000004,sig:11,src:000066,op:havoc,rep:16.gravity
  12. BIN
      test/fuzzy/2017-04-25/id:000004,sig:11,src:000395+001887,op:splice,rep:128.gravity
  13. 27 0
      test/fuzzy/2017-04-25/id:000004,sig:11,src:001026+001064,op:splice,rep:8.gravity
  14. BIN
      test/fuzzy/2017-04-25/id:000005,sig:11,src:000066,op:havoc,rep:16.gravity
  15. BIN
      test/fuzzy/2017-04-25/id:000005,sig:11,src:000518+000973,op:splice,rep:2.gravity
  16. BIN
      test/fuzzy/2017-04-25/id:000006,sig:11,src:000700+002175,op:splice,rep:128.gravity
  17. BIN
      test/fuzzy/2017-04-25/id:000007,sig:11,src:000714+000636,op:splice,rep:32.gravity
  18. 13 0
      test/fuzzy/2017-04-25/id:000008,sig:11,src:000083,op:arith8,pos:95,val:-2.gravity
  19. BIN
      test/fuzzy/2017-04-25/id:000011,sig:11,src:000088,op:havoc,rep:32.gravity
  20. BIN
      test/fuzzy/2017-04-25/id:000011,sig:11,src:000833+001084,op:splice,rep:2.gravity
  21. 17 0
      test/fuzzy/2017-04-25/id:000013,sig:06,src:000237,op:arith8,pos:232,val:+17.gravity
  22. 14 0
      test/fuzzy/2017-04-25/id:000019,sig:06,src:001037,op:arith8,pos:669,val:+19.gravity
  23. BIN
      test/fuzzy/2017-04-25/id:000019,sig:11,src:001426+001983,op:splice,rep:64.gravity
  24. BIN
      test/fuzzy/2017-04-25/id:000019,sig:11,src:002027+001069,op:splice,rep:2.gravity
  25. BIN
      test/fuzzy/2017-04-25/id:000020,sig:11,src:001532+001455,op:splice,rep:32.gravity
  26. 14 0
      test/fuzzy/2017-04-25/id:000021,sig:11,src:001037,op:ext_AO,pos:663.gravity
  27. BIN
      test/fuzzy/2017-04-25/id:000021,sig:11,src:001627,op:havoc,rep:4.gravity
  28. BIN
      test/fuzzy/2017-04-25/id:000022,sig:11,src:001627,op:havoc,rep:64.gravity
  29. BIN
      test/fuzzy/2017-04-25/id:000023,sig:11,src:001090,op:flip1,pos:108.gravity
  30. BIN
      test/fuzzy/2017-04-25/id:000025,sig:11,src:001544,op:havoc,rep:4.gravity
  31. BIN
      test/fuzzy/2017-04-25/id:000026,sig:11,src:001943+001819,op:splice,rep:64.gravity
  32. BIN
      test/fuzzy/2017-04-25/id:000027,sig:11,src:001943+001819,op:splice,rep:32.gravity
  33. BIN
      test/fuzzy/2017-04-25/id:000033,sig:11,src:002423+000012,op:splice,rep:16.gravity
  34. BIN
      test/fuzzy/2017-04-25/id:000039,sig:11,src:000060+001819,op:splice,rep:128.gravity
  35. BIN
      test/fuzzy/2017-04-25/id:000039,sig:11,src:002780,op:havoc,rep:64.gravity
  36. BIN
      test/fuzzy/2017-04-25/id:000041,sig:11,src:000480+002587,op:splice,rep:16.gravity
  37. BIN
      test/fuzzy/2017-04-25/id:000042,sig:11,src:000648+001194,op:splice,rep:64.gravity
  38. BIN
      test/fuzzy/2017-04-25/id:000042,sig:11,src:002782,op:havoc,rep:64.gravity
  39. BIN
      test/fuzzy/2017-04-25/id:000044,sig:11,src:000755+002227,op:splice,rep:64.gravity
  40. BIN
      test/fuzzy/2017-04-25/id:000044,sig:11,src:002782,op:havoc,rep:16.gravity
  41. BIN
      test/fuzzy/2017-04-25/id:000045,sig:11,src:000878+001819,op:splice,rep:128.gravity
  42. BIN
      test/fuzzy/2017-04-25/id:000046,sig:11,src:000897+001596,op:splice,rep:128.gravity
  43. BIN
      test/fuzzy/2017-04-25/id:000046,sig:11,src:002782,op:havoc,rep:64.gravity
  44. BIN
      test/fuzzy/2017-04-25/id:000048,sig:11,src:001908+002815,op:splice,rep:32.gravity
  45. BIN
      test/fuzzy/2017-04-25/id:000049,sig:11,src:002538+002827,op:splice,rep:16.gravity
  46. BIN
      test/fuzzy/2017-04-25/id:000052,sig:11,src:001150,op:havoc,rep:64.gravity
  47. BIN
      test/fuzzy/2017-04-25/id:000052,sig:11,src:002683+002876,op:splice,rep:64.gravity
  48. BIN
      test/fuzzy/2017-04-25/id:000053,sig:11,src:002785+001079,op:splice,rep:8.gravity
  49. BIN
      test/fuzzy/2017-04-25/id:000055,sig:11,src:002991+002893,op:splice,rep:16.gravity
  50. BIN
      test/fuzzy/2017-04-25/id:000056,sig:11,src:001178,op:havoc,rep:64.gravity
  51. 25 0
      test/fuzzy/2017-04-25/id:000057,sig:11,src:003053,op:havoc,rep:2.gravity
  52. BIN
      test/fuzzy/2017-04-25/id:000058,sig:11,src:001194,op:havoc,rep:64.gravity
  53. BIN
      test/fuzzy/2017-04-25/id:000058,sig:11,src:003054+002963,op:splice,rep:16.gravity
  54. BIN
      test/fuzzy/2017-04-25/id:000059,sig:11,src:003054+002963,op:splice,rep:64.gravity
  55. 18 0
      test/fuzzy/2017-04-25/id:000060,sig:11,src:001337,op:havoc,rep:2.gravity
  56. BIN
      test/fuzzy/2017-04-25/id:000061,sig:11,src:003076+002724,op:splice,rep:16.gravity
  57. BIN
      test/fuzzy/2017-04-25/id:000062,sig:11,src:000046+001514,op:splice,rep:128.gravity
  58. BIN
      test/fuzzy/2017-04-25/id:000062,sig:11,src:001484,op:havoc,rep:16.gravity
  59. BIN
      test/fuzzy/2017-04-25/id:000064,sig:11,src:002938,op:havoc,rep:8.gravity
  60. 0 0
      test/fuzzy/2017-04-25/id:000065,sig:11,src:000541+002437,op:splice,rep:128.gravity
  61. BIN
      test/fuzzy/2017-04-25/id:000066,sig:11,src:000679+001683,op:splice,rep:128.gravity
  62. BIN
      test/fuzzy/2017-04-25/id:000066,sig:11,src:003162+001444,op:splice,rep:8.gravity
  63. BIN
      test/fuzzy/2017-04-25/id:000067,sig:11,src:000705+001683,op:splice,rep:128.gravity
  64. 1 0
      test/fuzzy/2017-04-25/id:000067,sig:11,src:002056,op:havoc,rep:64.gravity
  65. BIN
      test/fuzzy/2017-04-25/id:000068,sig:11,src:003290+002724,op:splice,rep:64.gravity
  66. 186 0
      test/fuzzy/2017-04-25/id:000069,sig:11,src:002124,op:flip1,pos:1421.gravity
  67. 41 0
      test/fuzzy/2017-04-25/id:000072,sig:11,src:000052+002758,op:splice,rep:8.gravity
  68. BIN
      test/fuzzy/2017-04-25/id:000073,sig:11,src:003357+003196,op:splice,rep:128.gravity
  69. BIN
      test/fuzzy/2017-04-25/id:000074,sig:11,src:000364+000769,op:splice,rep:16.gravity
  70. 185 0
      test/fuzzy/2017-04-25/id:000074,sig:11,src:002124,op:ext_AO,pos:1446.gravity
  71. BIN
      test/fuzzy/2017-04-25/id:000075,sig:11,src:000374+001110,op:splice,rep:8.gravity
  72. BIN
      test/fuzzy/2017-04-25/id:000076,sig:11,src:000403+000907,op:splice,rep:128.gravity
  73. BIN
      test/fuzzy/2017-04-25/id:000076,sig:11,src:002124,op:havoc,rep:64.gravity
  74. BIN
      test/fuzzy/2017-04-25/id:000076,sig:11,src:003367+002885,op:splice,rep:32.gravity
  75. BIN
      test/fuzzy/2017-04-25/id:000077,sig:11,src:000648+001114,op:splice,rep:128.gravity
  76. BIN
      test/fuzzy/2017-04-25/id:000078,sig:11,src:003373,op:havoc,rep:8.gravity
  77. BIN
      test/fuzzy/2017-04-25/id:000079,sig:11,src:000667+001611,op:splice,rep:128.gravity
  78. 1 0
      test/fuzzy/2017-04-25/id:000079,sig:11,src:002215,op:havoc,rep:128.gravity
  79. 76 0
      test/fuzzy/2017-04-25/id:000080,sig:11,src:000768,op:havoc,rep:8.gravity
  80. BIN
      test/fuzzy/2017-04-25/id:000080,sig:11,src:001609+002794,op:splice,rep:128.gravity
  81. 16 0
      test/fuzzy/2017-04-25/id:000080,sig:11,src:002558,op:arith8,pos:113,val:+11.gravity
  82. BIN
      test/fuzzy/2017-04-25/id:000081,sig:11,src:000851+002175,op:splice,rep:64.gravity
  83. 16 0
      test/fuzzy/2017-04-25/id:000082,sig:06,src:002653,op:flip2,pos:136.gravity
  84. BIN
      test/fuzzy/2017-04-25/id:000082,sig:11,src:000862+000668,op:splice,rep:4.gravity
  85. BIN
      test/fuzzy/2017-04-25/id:000082,sig:11,src:003050+002867,op:splice,rep:128.gravity
  86. 26 0
      test/fuzzy/2017-04-25/id:000083,sig:11,src:001088+002764,op:splice,rep:4.gravity
  87. BIN
      test/fuzzy/2017-04-25/id:000083,sig:11,src:003413+002794,op:splice,rep:16.gravity
  88. 16 0
      test/fuzzy/2017-04-25/id:000084,sig:06,src:002653,op:ext_AO,pos:116.gravity
  89. BIN
      test/fuzzy/2017-04-25/id:000084,sig:11,src:001115+001683,op:splice,rep:128.gravity
  90. BIN
      test/fuzzy/2017-04-25/id:000084,sig:11,src:003413+002794,op:splice,rep:128.gravity
  91. BIN
      test/fuzzy/2017-04-25/id:000085,sig:11,src:001247+002218,op:splice,rep:16.gravity
  92. BIN
      test/fuzzy/2017-04-25/id:000085,sig:11,src:003418+003038,op:splice,rep:16.gravity
  93. BIN
      test/fuzzy/2017-04-25/id:000086,sig:11,src:001350+001683,op:splice,rep:32.gravity
  94. 9 0
      test/fuzzy/2017-04-25/id:000087,sig:06,src:002796,op:arith8,pos:95,val:+19.gravity
  95. 13 0
      test/fuzzy/2017-04-25/id:000088,sig:06,src:002872,op:arith8,pos:94,val:+19.gravity
  96. BIN
      test/fuzzy/2017-04-25/id:000088,sig:11,src:003422+002794,op:splice,rep:64.gravity
  97. 25 0
      test/fuzzy/2017-04-25/id:000089,sig:11,src:002946,op:havoc,rep:2.gravity
  98. 17 0
      test/fuzzy/2017-04-25/id:000090,sig:06,src:003099,op:arith8,pos:209,val:+17.gravity
  99. BIN
      test/fuzzy/2017-04-25/id:000090,sig:11,src:001673+002415,op:splice,rep:4.gravity
  100. BIN
      test/fuzzy/2017-04-25/id:000090,sig:11,src:003505+003206,op:splice,rep:8.gravity

+ 9 - 1
src/cli/unittest.c

@@ -13,6 +13,7 @@
 
 typedef struct {
 	bool			processed;
+    bool            is_fuzzy;
 	
 	uint32_t		ncount;
 	uint32_t		nsuccess;
@@ -69,6 +70,12 @@ static void callback_error (error_type_t error_type, const char *message, error_
 	bool same_row = (data->expected_row != -1) ? (data->expected_row == error_desc.lineno) : true;
 	bool same_col = (data->expected_col != -1) ? (data->expected_col == error_desc.colno) : true;
 	
+    if (data->is_fuzzy) {
+        ++data->nsuccess;
+        printf("\tSUCCESS\n");
+        return;
+    }
+    
 	if (same_error && same_row && same_col) {
 		++data->nsuccess;
 		printf("\tSUCCESS\n");
@@ -117,6 +124,7 @@ static void test_folder (const char *folder_path, test_data *data) {
 		
 		// test only files with a .gravity extension
 		if (strstr(full_path, ".gravity") == NULL) continue;
+        data->is_fuzzy = (strstr(full_path, "/fuzzy/") != NULL);
 		
 		// load source code
 		size_t size = 0;
@@ -149,7 +157,7 @@ static void test_folder (const char *folder_path, test_data *data) {
 			if (gravity_vm_runmain(vm, closure)) {
 				data->processed = true;
 				gravity_value_t result = gravity_vm_result(vm);
-				if (gravity_value_equals(result, data->expected_value)) {
+				if (data->is_fuzzy || gravity_value_equals(result, data->expected_value)) {
 					++data->nsuccess;
 					printf("\tSUCCESS\n");
 				} else {

+ 10 - 6
src/compiler/gravity_codegen.c

@@ -653,7 +653,11 @@ static void store_declaration (gvisitor_t *self, gravity_object_t *obj, bool is_
 	bool is_module = CONTEXT_IS_MODULE(context_object);
 	bool is_class = OBJECT_ISA_CLASS(context_object);
 	bool is_local = ((is_module == false) && (is_class == false));
-	if (is_static) assert(is_class); // static makes sense only for class objects
+    if (is_static && !is_class){
+        // static makes sense only for class objects
+        report_error(self, (gnode_t *)node, "Static storage specifier does not make sense in non class context.");
+        return;
+    }
 	
 	if (is_local || is_module) {
 		gravity_function_t *context_function = (gravity_function_t *)context_object;
@@ -1310,7 +1314,7 @@ static void visit_postfix_expr (gvisitor_t *self, gnode_postfix_expr_t *node) {
 					nreg = ircode_register_pop_context_protect(code, true);
 					if (nreg == REGISTER_ERROR) report_error(self, (gnode_t *)arg, "Invalid argument expression");
 				}
-				DEBUG_ASSERT(nreg == temp_target_register + j + 2, "Invalid register computation in call expression.");
+				if (nreg != temp_target_register + j + 2) report_error(self, (gnode_t *)arg, "Invalid register computation in call expression.");
 				marray_push(uint32_t, args, nreg);
 			}
 			
@@ -1735,8 +1739,8 @@ static void visit_list_expr (gvisitor_t *self, gnode_list_expr_t *node) {
 				ircode_add(code, MOVE, temp_register, nreg, 0);
 				ircode_register_clear(code, nreg);
 				uint32_t temp = ircode_register_pop_context_protect(code, true);
-				DEBUG_ASSERT(temp != REGISTER_ERROR, "Unexpected register error.");
-				DEBUG_ASSERT(temp_register == dest + i, "Unexpected register computation.");
+                if (temp == REGISTER_ERROR) {report_error(self, (gnode_t *)e, "Unexpected register error."); continue;}
+                if (temp_register != dest + i) {report_error(self, (gnode_t *)e, "Unexpected register computation."); continue;}
 			}
 			
 			if (ismap) {
@@ -1755,8 +1759,8 @@ static void visit_list_expr (gvisitor_t *self, gnode_list_expr_t *node) {
 					ircode_add(code, MOVE, temp_register, nreg, 0);
 					ircode_register_clear(code, nreg);
 					uint32_t temp = ircode_register_pop_context_protect(code, true);
-					DEBUG_ASSERT(temp != REGISTER_ERROR, "Unexpected register error.");
-					DEBUG_ASSERT(temp_register == dest + i + 1, "Unexpected register computation.");
+					if (temp == REGISTER_ERROR) {report_error(self, (gnode_t *)e, "Unexpected register error."); continue;}
+					if (temp_register != dest + i + 1) {report_error(self, (gnode_t *)e, "Unexpected register computation."); continue;}
 				}
 			}
 			

+ 4 - 0
src/compiler/gravity_lexer.c

@@ -350,11 +350,15 @@ static gtoken_t lexer_scan_string(gravity_lexer_t *lexer) {
 			INC_OFFSET_POSITION;
 			INC_TOKLEN;
 			INC_TOKLEN;
+            
+            // sanity check
+            if (IS_EOF) return lexer_error(lexer, "Unexpected EOF inside a string literal");
 			continue;
 		}
 		
 		// scan next
 		if (!next_utf8(lexer, NULL)) return lexer_error(lexer, "Unknown character inside a string literal");
+        if (IS_EOF) return lexer_error(lexer, "Unexpected EOF inside a string literal");
 	}
 	
 	// skip last escape character

+ 35 - 3
src/compiler/gravity_parser.c

@@ -30,7 +30,8 @@ struct gravity_parser_t {
 	uint32_t							nerrors;
 	uint32_t							unique_id;
 	uint32_t							last_error_lineno;
-    uint32_t                            depth;
+    uint32_t                            depth;              // to keep track of maximum statements depth
+    uint32_t                            expr_depth;         // to keep track of maximum expression depth
 	
 	// state ivars used by Pratt parser
 	gtoken_t							current_token;
@@ -83,6 +84,7 @@ static grammar_rule rules[TOK_END];
 
 // MARK: - Internal macros -
 #define MAX_RECURSION_DEPTH                     1000
+#define MAX_EXPRESSION_DEPTH                    512
 #define MAX_NUMBER_LENGTH                       512
 #define SEMICOLON_IS_OPTIONAL					1
 
@@ -215,6 +217,18 @@ static bool parse_optional (gravity_parser_t *parser, gtoken_t token) {
 	return false;
 }
 
+static bool parse_skip_until (gravity_parser_t *parser, gtoken_t token) {
+    DECLARE_LEXER;
+    
+    while (1) {
+        gtoken_t tok = gravity_lexer_next(lexer);
+        if (tok == token) return true;
+        if (tok == TOK_EOF) return false;
+    }
+    
+    return false;
+}
+
 static bool parse_required (gravity_parser_t *parser, gtoken_t token) {
 	if (parse_optional(parser, token)) return true;
 	
@@ -321,8 +335,14 @@ static gnode_t *decl_check_access_specifier (gnode_t *node) {
     if (node->tag == NODE_VARIABLE_DECL) {
         // default access specifier for variables is TOK_KEY_PUBLIC
         gnode_variable_decl_t *vdec_node = (gnode_variable_decl_t *)node;
-        bool is_private = ((gnode_array_size(vdec_node->decls) > 0) && (((gnode_var_t *)gnode_array_get(vdec_node->decls, 0))->identifier[0] == '_'));
-        if (vdec_node->access == 0) vdec_node->access = (is_private) ? TOK_KEY_PRIVATE : TOK_KEY_PUBLIC;
+        if (vdec_node->access == 0) {
+            bool is_private = false;
+            if (gnode_array_size(vdec_node->decls) > 0) {
+                gnode_var_t *var = (gnode_var_t *)gnode_array_get(vdec_node->decls, 0);
+                is_private = (var->identifier && var->identifier[0] == '_');
+            }
+            vdec_node->access = (is_private) ? TOK_KEY_PRIVATE : TOK_KEY_PUBLIC;
+        }
     } else if (node->tag == NODE_FUNCTION_DECL) {
         // default access specifier for functions is PUBLIC
         gnode_function_decl_t *fdec_node = (gnode_function_decl_t *)node;
@@ -981,7 +1001,16 @@ static gnode_t *parse_precedence(gravity_parser_t *parser, prec_level precedence
 	
 	// execute prefix callback (if any)
 	parse_func prefix = rules[type].prefix;
+    
+    // to protect stack from excessive recursion
+    if (prefix && (++parser->expr_depth > MAX_EXPRESSION_DEPTH)) {
+        // consume next token to avoid infinite loops
+        gravity_lexer_next(lexer);
+        REPORT_ERROR(gravity_lexer_token(lexer), "Maximum expression depth reached.");
+        return NULL;
+    }
 	gnode_t *node = (prefix) ? prefix(parser) : NULL;
+    if (prefix) --parser->expr_depth;
 	
 	if (!prefix || !node) {
 		// we need to consume next token because error was triggered in peek
@@ -1939,7 +1968,10 @@ static gnode_t *parse_unittest_macro (gravity_parser_t *parser) {
 	if (value_node) gnode_free((gnode_t*)value_node);
 	
 	// always return NULL
+    return NULL;
+    
 handle_error:
+    parse_skip_until(parser, TOK_OP_CLOSED_CURLYBRACE);
 	return NULL;
 }
 

+ 73 - 14
src/compiler/gravity_semacheck2.c

@@ -101,7 +101,6 @@ static symboltable_t *symtable_from_node (gnode_t *node) {
 	if (ISA(node, NODE_FUNCTION_DECL)) return ((gnode_function_decl_t *)node)->symtable;
 	
 	// should never reach this point
-	assert(0);
 	return NULL;
 }
 
@@ -154,6 +153,7 @@ static gnode_t *lookup_identifier (gvisitor_t *self, const char *identifier, gno
 				}
 			 */
 			REPORT_ERROR(node, "Unable to access local func var %s from within a class.", identifier);
+            return NULL;
 		}
 		
 		// if target is class and symbol is not found then lookup also its superclass hierarchy
@@ -161,6 +161,11 @@ static gnode_t *lookup_identifier (gvisitor_t *self, const char *identifier, gno
 			// lookup identifier in super (if not found target class)
 			gnode_class_decl_t *c = (gnode_class_decl_t *)target;
 			gnode_class_decl_t *super = (gnode_class_decl_t *)c->superclass;
+            if (super && !NODE_ISA(super, NODE_CLASS_DECL)) {
+                REPORT_ERROR(node, "Cannot set superclass of %s to non class object.", c->identifier);
+                return NULL;
+            }
+            
 			while (super) {
 				symbol = lookup_node((gnode_t *)super, identifier);
 				if (symbol) {
@@ -168,6 +173,7 @@ static gnode_t *lookup_identifier (gvisitor_t *self, const char *identifier, gno
 						gnode_var_t *p = (gnode_var_t *)symbol;
 						if (p->access == TOK_KEY_PRIVATE) {
 							REPORT_ERROR(node, "Forbidden access to private ivar %s from a subclass.", p->identifier);
+                            return NULL;
 						}
 					}
 					break;
@@ -211,8 +217,12 @@ static gnode_t *lookup_identifier (gvisitor_t *self, const char *identifier, gno
 				// base_node has index = len - 1 so from (len - 2) up to n-1 levels
 				uint16_t idx = (uint16_t)(len - 2);
 				while (n > 1) {
-					f = (gnode_function_decl_t *) gnode_array_get(decls, idx);
-					gnode_function_add_upvalue(f, var, --n);
+					gnode_t *enc_node = gnode_array_get(decls, idx);
+                    if (!(ISA(enc_node, NODE_FUNCTION_DECL))) {
+                        REPORT_ERROR(node, "An error occurred while setting upvalue for enclosing functions.");
+                        return NULL;
+                    }
+					gnode_function_add_upvalue((gnode_function_decl_t *)enc_node, var, --n);
 					--idx;
 				}
 				
@@ -271,6 +281,7 @@ static bool is_expression (gnode_t *node) {
 }
 
 static bool is_expression_assignment (gnode_t *node) {
+    if (!node) return false;
 	gnode_n tag = NODE_TAG(node);
 	if (tag == NODE_BINARY_EXPR) {
 		gnode_binary_expr_t *expr = (gnode_binary_expr_t *)node;
@@ -436,10 +447,12 @@ static bool check_assignment_expression (gvisitor_t *self, gnode_binary_expr_t *
 		if (ISA(expr->id, NODE_LITERAL_EXPR)) {
 			result = false;
 		} else {
+            if (!expr->list) return false;
 			// basically the LATEST node of a postfix expression cannot be a CALL in an assignment
 			// so we are avoiding expressions like: a(123) = ...; or a.b.c(1,2) = ...;
 			size_t count = gnode_array_size(expr->list);
 			gnode_postfix_subexpr_t *subnode = (gnode_postfix_subexpr_t *)gnode_array_get(expr->list, count-1);
+            if (!subnode) return false;
 			result = (NODE_TAG(subnode) != NODE_CALL_EXPR);
 		}
 	}
@@ -459,7 +472,7 @@ static bool check_range_expression (gvisitor_t *self, gnode_binary_expr_t *node)
 		gnode_t *range = r[i];
 		if (ISA_LITERAL(range)) {
 			gnode_literal_expr_t *expr = (gnode_literal_expr_t *)range;
-			if (expr->type != LITERAL_INT) {REPORT_ERROR(node, "Range must be integer.");} return false;
+			if (expr->type != LITERAL_INT) {REPORT_ERROR(node, "Range must be integer."); return false;}
 		}
 	}
 	return true;
@@ -469,8 +482,11 @@ static bool check_class_ivar (gvisitor_t *self, gnode_class_decl_t *classnode, g
 	size_t count = gnode_array_size(node->decls);
 	
 	gnode_class_decl_t *supernode = (gnode_class_decl_t *)classnode->superclass;
+    if (!NODE_ISA(supernode, NODE_CLASS_DECL)) return false;
+    
 	for (size_t i=0; i<count; ++i) {
 		gnode_var_t *p = (gnode_var_t *)gnode_array_get(node->decls, i);
+        if (!p) continue;
 		DEBUG_SEMANTIC("check_ivar %s", p->identifier);
 		
 		// do not check internal outer var
@@ -479,7 +495,8 @@ static bool check_class_ivar (gvisitor_t *self, gnode_class_decl_t *classnode, g
 		while (supernode) {
 			symboltable_t *symtable = supernode->symtable;
 			if (symboltable_lookup(symtable, p->identifier) != NULL) {
-				REPORT_WARNING((gnode_t *)node, "Property '%s' defined in class '%s' already defined in its superclass %s.", p->identifier, classnode->identifier, supernode->identifier);
+				REPORT_WARNING((gnode_t *)node, "Property '%s' defined in class '%s' already defined in its superclass %s.",
+                               p->identifier, classnode->identifier, supernode->identifier);
 			}
 			supernode = (gnode_class_decl_t *)supernode->superclass;
 		}
@@ -522,6 +539,7 @@ static void visit_compound_stmt (gvisitor_t *self, gnode_compound_stmt_t *node)
 	gnode_t			*top = TOP_DECLARATION();
 	symboltable_t	*symtable = symtable_from_node(top);
 	
+    if (!symtable) return;
 	symboltable_enter_scope(symtable);
 	gnode_array_each(node->stmts, {visit(val);});
 	
@@ -572,13 +590,28 @@ static void visit_loop_stmt (gvisitor_t *self, gnode_loop_stmt_t *node) {
 	
 	// check pre-conditions
 	const char	*LOOP_NAME;
-	gnode_t		*cond;
+	gnode_t		*cond = NULL;
 	if (type == TOK_KEY_WHILE) {LOOP_NAME = "WHILE"; cond = node->cond;}
 	else if (type == TOK_KEY_REPEAT) {LOOP_NAME = "REPEAT"; cond = node->expr;}
 	else if (type == TOK_KEY_FOR) {LOOP_NAME = "FOR"; cond = node->cond;}
-	else {cond = NULL; assert(0);}
-	if (is_expression_assignment(cond))
+    
+    // sanity check
+    if (type == TOK_KEY_WHILE) {
+        if (!node->cond) {REPORT_ERROR(node, "Missing %s condition.", LOOP_NAME); return;}
+        if (!node->stmt) {REPORT_ERROR(node, "Missing %s statement.", LOOP_NAME); return;}
+    } else if (type == TOK_KEY_REPEAT) {
+        if (!node->stmt) {REPORT_ERROR(node, "Missing %s statement.", LOOP_NAME); return;}
+        if (!node->expr) {REPORT_ERROR(node, "Missing %s expression.", LOOP_NAME); return;}
+    } else if (type == TOK_KEY_FOR) {
+        if (!node->cond) {REPORT_ERROR(node, "Missing %s condition.", LOOP_NAME); return;}
+        if (!node->expr) {REPORT_ERROR(node, "Missing %s expression.", LOOP_NAME); return;}
+        if (!node->stmt) {REPORT_ERROR(node, "Missing %s statement.", LOOP_NAME); return;}
+    }
+    
+    if (is_expression_assignment(cond)) {
 		REPORT_ERROR(cond, "Assignments in Gravity does not return a value so cannot be used inside a %s condition.", LOOP_NAME);
+        return;
+    }
 	
 	// FOR condition MUST be a VARIABLE declaration or an IDENTIFIER
 	if (type == TOK_KEY_FOR) {
@@ -682,7 +715,10 @@ static void visit_function_decl (gvisitor_t *self, gnode_function_decl_t *node)
 		gnode_array_each(node->params, {
 			gnode_var_t *p = (gnode_var_t *)val;
 			p->env = (gnode_t*)node;
-			if (!symboltable_insert(symtable, p->identifier, (void *)p)) REPORT_ERROR(p, "Parameter %s redeclared.", p->identifier);
+            if (!symboltable_insert(symtable, p->identifier, (void *)p)) {
+                REPORT_ERROR(p, "Parameter %s redeclared.", p->identifier);
+                continue;
+            }
 			SET_LOCAL_INDEX(p, symtable);
 			DEBUG_SEMANTIC("Local:%s index:%d", p->identifier, p->index);
 		});
@@ -695,10 +731,13 @@ static void visit_function_decl (gvisitor_t *self, gnode_function_decl_t *node)
 	// exit function scope
 	uint16_t nparams = (node->params) ? (uint16_t)marray_size(*node->params) : 0;
 	uint32_t nlocals = symboltable_exit_scope(symtable, NULL);
-	if (nlocals > MAX_LOCALS) REPORT_ERROR(node, "Maximum number of local variables reached in function %s (max:%d found:%d).",
+    if (nlocals > MAX_LOCALS) {
+        REPORT_ERROR(node, "Maximum number of local variables reached in function %s (max:%d found:%d).",
 										   node->identifier, MAX_LOCALS, nlocals);
-	node->nlocals = (uint16_t)nlocals - nparams;
-	node->nparams = nparams;
+    } else {
+		node->nlocals = (uint16_t)nlocals - nparams;
+		node->nparams = nparams;
+    }
 	
 	// check upvalue limit
 	uint32_t nupvalues = (node->uplist) ? (uint32_t)marray_size(*node->uplist) : 0;
@@ -734,7 +773,10 @@ static void visit_variable_decl (gvisitor_t *self, gnode_variable_decl_t *node)
 		
 		if (env_is_function) {
 			// local variable defined inside a function
-			if (!symboltable_insert(symtable, p->identifier, (void *)p)) REPORT_ERROR(p, "Identifier %s redeclared.", p->identifier);
+            if (!symboltable_insert(symtable, p->identifier, (void *)p)) {
+                REPORT_ERROR(p, "Identifier %s redeclared.", p->identifier);
+                continue;
+            }
 			SET_LOCAL_INDEX(p, symtable);
 			DEBUG_SEMANTIC("Local:%s index:%d", p->identifier, p->index);
 		} else if (env == NODE_CLASS_DECL) {
@@ -747,6 +789,8 @@ static void visit_variable_decl (gvisitor_t *self, gnode_variable_decl_t *node)
 			
 			// super class is a static information so I can solve the fragile class problem at compilation time
 			gnode_class_decl_t *super = (gnode_class_decl_t *)c->superclass;
+            if (super && !NODE_ISA(super, NODE_CLASS_DECL)) return;
+            
 			while (super) {
 				n2 = (node->storage == TOK_KEY_STATIC) ? super->nsvar : super->nivar;
 				super = (gnode_class_decl_t *)super->superclass;
@@ -789,8 +833,22 @@ static void visit_class_decl (gvisitor_t *self, gnode_class_decl_t *node) {
         
         // lookup super node
 		gnode_t *target = lookup_symtable_id(self, id, true);
-		if (!target) REPORT_ERROR(id, "Unable to find superclass %s for class %s.", id->value, node->identifier);
 		node->superclass = target;
+        
+        if (!target) {
+            REPORT_ERROR(id, "Unable to find superclass %s for class %s.", id->value, node->identifier);
+        } else {
+            gnode_class_decl_t *target_class = NODE_ISA(target, NODE_CLASS_DECL) ? (gnode_class_decl_t *)target : NULL;
+            
+            if (!target_class) {
+                REPORT_ERROR(id, "Unable to set non class %s as superclass of %s.", id->value, node->identifier);
+            } else if ((gnode_class_decl_t *)node == (gnode_class_decl_t *)target_class->superclass) {
+                REPORT_ERROR(id, "Unable to set circular class hierarchies (%s <-> %s).", id->value, node->identifier);
+                gnode_free((gnode_t*)id);
+                return;
+            }
+        }
+        
 		gnode_free((gnode_t*)id);
 	}
 	
@@ -973,6 +1031,7 @@ static void visit_postfix_expr (gvisitor_t *self, gnode_postfix_expr_t *node) {
 			size_t n = gnode_array_size(subnode->args);
 			for (size_t j=0; j<n; ++j) {
 				gnode_t *val = (gnode_t *)gnode_array_get(subnode->args, j);
+                if (is_expression_assignment(val)) {REPORT_ERROR(val, "Assignment does not have side effects and so cannot be used as function argument."); return;}
 				visit(val);
 			}
 			continue;

+ 2 - 0
src/compiler/gravity_symboltable.c

@@ -94,6 +94,8 @@ void symboltable_free (symboltable_t *table) {
 }
 
 bool symboltable_insert (symboltable_t *table, const char *identifier, gnode_t *node) {
+    if (!identifier) return false;
+    
 	size_t			n = scope_stack_size(table->stack);
 	gravity_hash_t	*h = scope_stack_get(table->stack, n-1);
 	

+ 14 - 6
src/runtime/gravity_core.c

@@ -624,7 +624,7 @@ static bool object_notfound (gravity_vm *vm, gravity_value_t *args, uint16_t nar
 	#pragma unused(nargs,rindex)
 	gravity_class_t *c = gravity_value_getclass(GET_VALUE(0));
 	gravity_value_t key = GET_VALUE(1); // vm_getslot(vm, rindex);
-	RETURN_ERROR("Unable to find %s into class %s", VALUE_AS_CSTRING(key), c->identifier);
+    RETURN_ERROR("Unable to find %s into class %s", VALUE_ISA_STRING(key) ? VALUE_AS_CSTRING(key) : "N/A", c->identifier);
 }
 
 static bool object_bind (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) {
@@ -749,6 +749,7 @@ static bool list_storeat (gravity_vm *vm, gravity_value_t *args, uint16_t nargs,
 	if ((uint32_t)index >= count) {
 		// handle list resizing here
 		marray_resize(gravity_value_t, list->array, index-count);
+        if (!list->array.p) RETURN_ERROR("Not enough memory to resize List.");
 		marray_nset(list->array, index+1);
 		for (int32_t i=count; i<index; ++i) {
 			marray_set(list->array, i, VALUE_FROM_NULL);
@@ -1936,14 +1937,21 @@ static bool fiber_yield (gravity_vm *vm, gravity_value_t *args, uint16_t nargs,
     // set rindex slot to NULL in order to falsify the if closure check performed by the VM
     gravity_vm_setslot(vm, VALUE_FROM_NULL, rindex);
     
+    // get currently executed fiber
 	gravity_fiber_t *fiber = gravity_vm_fiber(vm);
-	gravity_vm_setfiber(vm, fiber->caller);
+    
+    // in no caller then this is just a NOP
+    if (fiber->caller) {
+		gravity_vm_setfiber(vm, fiber->caller);
 	
-	// unhook this fiber from the one that called it
-	fiber->caller = NULL;
-	fiber->trying = false;
+		// unhook this fiber from the one that called it
+		fiber->caller = NULL;
+		fiber->trying = false;
 	
-	RETURN_FIBER();
+		RETURN_FIBER();
+    } else {
+        RETURN_NOVALUE();
+    }
 }
 
 static bool fiber_status (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) {

+ 3 - 2
src/runtime/gravity_vm.c

@@ -429,7 +429,7 @@ static bool gravity_vm_exec (gravity_vm *vm) {
 						gravity_class_t *super = gravity_value_getsuper(STACK_GET(0));
 						SETVALUE(r1, (super) ? VALUE_FROM_OBJECT(super) : VALUE_FROM_NULL);
 					} break;
-					case CPOOL_VALUE_ARGUMENTS: SETVALUE(r1, VALUE_FROM_OBJECT(frame->args)); break;
+                    case CPOOL_VALUE_ARGUMENTS: SETVALUE(r1, (frame->args) ? VALUE_FROM_OBJECT(frame->args) : VALUE_FROM_NULL); break;
 					case CPOOL_VALUE_NULL: SETVALUE(r1, VALUE_FROM_NULL); break;
 					case CPOOL_VALUE_UNDEFINED: SETVALUE(r1, VALUE_FROM_UNDEFINED); break;
 					case CPOOL_VALUE_TRUE: SETVALUE(r1, VALUE_FROM_TRUE); break;
@@ -1214,6 +1214,7 @@ static bool gravity_vm_exec (gravity_vm *vm) {
 					gravity_map_t *map = VALUE_AS_MAP(v1);
 					while (r2) {
 						gravity_value_t key = STACK_GET(++r1);
+                        if (!VALUE_ISA_STRING(key)) RUNTIME_ERROR("Unable to build Map from a non String key");
 						gravity_value_t value = STACK_GET(++r1);
 						gravity_hash_insert(map->hash, key, value);
 						--r2;
@@ -1250,7 +1251,7 @@ static bool gravity_vm_exec (gravity_vm *vm) {
 					OPCODE_GET_ONE8bit_ONE18bit(inst, const uint32_t p1, const uint32_t p2);
 					
 					// p2 can be 1 (means that upvalue is in the current call frame) or 0 (means that upvalue is in the upvalue list of the caller)
-					DEBUG_ASSERT(op == MOVE, "Wrong OPCODE in CLOSURE statement");
+					if (op != MOVE) RUNTIME_ERROR("Wrong OPCODE in CLOSURE statement");
 					closure->upvalue[i] = (p2) ? gravity_capture_upvalue (vm, fiber, &stackstart[p1]) : frame->closure->upvalue[p1];
 				}
 				

+ 1 - 1
src/shared/gravity_value.c

@@ -1507,7 +1507,7 @@ inline gravity_class_t *gravity_value_getclass (gravity_value_t v) {
 
 inline gravity_class_t *gravity_value_getsuper (gravity_value_t v) {
 	gravity_class_t *c = gravity_value_getclass(v);
-	return (c->superclass) ? c->superclass : NULL;
+	return (c && c->superclass) ? c->superclass : NULL;
 }
 
 void gravity_value_free (gravity_vm *vm, gravity_value_t v) {

+ 22 - 0
test/fuzzy/2017-04-25/id:000000,sig:11,src:000035,op:havoc,rep:2.gravity

@@ -0,0 +1,22 @@
+#unittest {
+	name: "Fiber basPc usage.";
+	result: 23;
+};
+
+var g = 0;
+
+func main() {
+    var fiber = Fiber.create({
+        g += 10;
+        Fiber.yield()
+        g += 10;
+    });
+    
+    g += 1;
+    fiber()
+    g += 1;
+  Fiber.yield()
+          fiber()
+    g += 1;
+     return g;
+}

BIN
test/fuzzy/2017-04-25/id:000004,sig:11,src:000066,op:havoc,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000004,sig:11,src:000395+001887,op:splice,rep:128.gravity


+ 27 - 0
test/fuzzy/2017-04-25/id:000004,sig:11,src:001026+001064,op:splice,rep:8.gravity

@@ -0,0 +1,27 @@
+#unÿtest {
+	name: "ise and on a boo.";
+	error: NONE;
+	res…lt: 64/a {
+	retu‚n a*2;
+}
+class c3 {# {
+		p1 = foo;
+	}
+}
+
+c:ass c2{
+	var p1 = 333;
+	func init() {
+		p1 = c3()[
+	}
+}
+
+class c1 {
+	var p1 = 111;
+	func ‹nit() {
+		p1 = c2();
+	}
+}
++func main()rrrrrrrrrrrrrrrrrrrr {
+	return c().p1.p1.p1(1234);
+}

BIN
test/fuzzy/2017-04-25/id:000005,sig:11,src:000066,op:havoc,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000005,sig:11,src:000518+000973,op:splice,rep:2.gravity


BIN
test/fuzzy/2017-04-25/id:000006,sig:11,src:000700+002175,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000007,sig:11,src:000714+000636,op:splice,rep:32.gravity


+ 13 - 0
test/fuzzy/2017-04-25/id:000008,sig:11,src:000083,op:arith8,pos:95,val:-2.gravity

@@ -0,0 +1,13 @@
+#unittest {
+	name: "Test static init.";
+	error: NONE;
+	result: 50;
+};
+
+class foo {
+	static var _ = 50;
+}
+
+func main() {
+	return foo.a;
+}

BIN
test/fuzzy/2017-04-25/id:000011,sig:11,src:000088,op:havoc,rep:32.gravity


BIN
test/fuzzy/2017-04-25/id:000011,sig:11,src:000833+001084,op:splice,rep:2.gravity


+ 17 - 0
test/fuzzy/2017-04-25/id:000013,sig:06,src:000237,op:arith8,pos:232,val:+17.gravity

@@ -0,0 +1,17 @@
+#unittest {
+	name: "_argn expression.";
+	error: NONE;
+	result: 640;
+};
+
+func sum() {
+	var tot = 0;
+	_args.loop(func (value) {tot +=value});
+	return tot;
+}
+
+func main() {
+	var a 5 10;
+	var b = 20;
+	return sum(a, b, a*(a+b+9)+(b-a), a= a*b)
+}

+ 14 - 0
test/fuzzy/2017-04-25/id:000019,sig:06,src:001037,op:arith8,pos:669,val:+19.gravity

@@ -0,0 +1,14 @@
+#unittest {
+	name: "Big list/map.";
+	error: NONE;
+	result: 275;
+};
+
+func main() {
+	// MAxFLUSH set to 64
+	var a1 = [1,2,3];
+	var a2 = [1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,67777777777777777777773,4,5,6,7,8,1,2,3,4,5,6,720,30,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,10,20,30,666];
+	var a3 = ["k1":1,"k2":2?"k3":3,"k4":4,"k5":5,"k6":6,"k7":7,"k8":8,"k9":9];
+	
+	return a1.count + a2.count + a3.count;
+}

BIN
test/fuzzy/2017-04-25/id:000019,sig:11,src:001426+001983,op:splice,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000019,sig:11,src:002027+001069,op:splice,rep:2.gravity


BIN
test/fuzzy/2017-04-25/id:000020,sig:11,src:001532+001455,op:splice,rep:32.gravity


+ 14 - 0
test/fuzzy/2017-04-25/id:000021,sig:11,src:001037,op:ext_AO,pos:663.gravity

@@ -0,0 +1,14 @@
+#unittest {
+	name: "Big list/map.";
+	error: NONE;
+	result: 275;
+};
+
+func main() {
+	// MAxFLUSH set to 64
+	var a1 = [1,2,3];
+	var a2 = [1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,67777777777777777777773,4,5,6,7,8,1,2,3,4,5,6,720,30,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,10,20,30,666];
+	var a3 = ["k1":1,self:2,"k3":3,"k4":4,"k5":5,"k6":6,"k7":7,"k8":8,"k9":9];
+	
+	return a1.count + a2.count + a3.count;
+}

BIN
test/fuzzy/2017-04-25/id:000021,sig:11,src:001627,op:havoc,rep:4.gravity


BIN
test/fuzzy/2017-04-25/id:000022,sig:11,src:001627,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000023,sig:11,src:001090,op:flip1,pos:108.gravity


BIN
test/fuzzy/2017-04-25/id:000025,sig:11,src:001544,op:havoc,rep:4.gravity


BIN
test/fuzzy/2017-04-25/id:000026,sig:11,src:001943+001819,op:splice,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000027,sig:11,src:001943+001819,op:splice,rep:32.gravity


BIN
test/fuzzy/2017-04-25/id:000033,sig:11,src:002423+000012,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000039,sig:11,src:000060+001819,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000039,sig:11,src:002780,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000041,sig:11,src:000480+002587,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000042,sig:11,src:000648+001194,op:splice,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000042,sig:11,src:002782,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000044,sig:11,src:000755+002227,op:splice,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000044,sig:11,src:002782,op:havoc,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000045,sig:11,src:000878+001819,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000046,sig:11,src:000897+001596,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000046,sig:11,src:002782,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000048,sig:11,src:001908+002815,op:splice,rep:32.gravity


BIN
test/fuzzy/2017-04-25/id:000049,sig:11,src:002538+002827,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000052,sig:11,src:001150,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000052,sig:11,src:002683+002876,op:splice,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000053,sig:11,src:002785+001079,op:splice,rep:8.gravity


BIN
test/fuzzy/2017-04-25/id:000055,sig:11,src:002991+002893,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000056,sig:11,src:001178,op:havoc,rep:64.gravity


+ 25 - 0
test/fuzzy/2017-04-25/id:000057,sig:11,src:003053,op:havoc,rep:2.gravity

@@ -0,0 +1,25 @@
+#unittest {
+	name: "Fiber basic usage.";
+	result: 2 ;
+};
+
+var g =r,create({
+        g += 10;
+        Fiber.yield()
+        g += 10;
+    }); 0;
+
+func main() {
+    var fiber = Fiber,create({
+        g += 10;
+        Fiber.yield()
+        g += 10;
+    });
+    
+    g += 1;
+    fiber()
+    g += 1;
+    fiber()
+    g += 1;
+     return g;
+}

BIN
test/fuzzy/2017-04-25/id:000058,sig:11,src:001194,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000058,sig:11,src:003054+002963,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000059,sig:11,src:003054+002963,op:splice,rep:64.gravity


+ 18 - 0
test/fuzzy/2017-04-25/id:000060,sig:11,src:001337,op:havoc,rep:2.gravity

@@ -0,0 +1,18 @@
+#unittest {
+	name: "List append rsion.";
	error: NONE;
+	result: "[0, 1, 2, 3, 4]";
+};
+
+func main() {
+	var x = [];
+	
+	x[0] = 0;
+	x[1] = 1;
+	x[2] = 2;
+	x[3333333333333] = 3;
+	x[4] = 4;
+	
+	var ret = "[" + x[0] x[1] + ", "
+		+ x[2] + ", "[3] + ", "
+		+ x[4] + "]";return ret;
+}

BIN
test/fuzzy/2017-04-25/id:000061,sig:11,src:003076+002724,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000062,sig:11,src:000046+001514,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000062,sig:11,src:001484,op:havoc,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000064,sig:11,src:002938,op:havoc,rep:8.gravity


File diff suppressed because it is too large
+ 0 - 0
test/fuzzy/2017-04-25/id:000065,sig:11,src:000541+002437,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000066,sig:11,src:000679+001683,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000066,sig:11,src:003162+001444,op:splice,rep:8.gravity


BIN
test/fuzzy/2017-04-25/id:000067,sig:11,src:000705+001683,op:splice,rep:128.gravity


+ 1 - 0
test/fuzzy/2017-04-25/id:000067,sig:11,src:002056,op:havoc,rep:64.gravity

@@ -0,0 +1 @@
+while

BIN
test/fuzzy/2017-04-25/id:000068,sig:11,src:003290+002724,op:splice,rep:64.gravity


+ 186 - 0
test/fuzzy/2017-04-25/id:000069,sig:11,src:002124,op:flip1,pos:1421.gravity

@@ -0,0 +1,186 @@
+#unittest {
+	name: "ed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+				 classes example.";
+	err;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+					public vaed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+					public var p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5(r p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5().p6;
+	public vaed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+3;
+			
+			class"c4 {
+				
+				class c5 {
+					public var p6;
+	ë			
+					//
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;func main() {
+	return c1().p1.p2.p3[2]().p5(r p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5().p6;
+}

+ 41 - 0
test/fuzzy/2017-04-25/id:000072,sig:11,src:000052+002758,op:splice,rep:8.gravity

@@ -0,0 +1,41 @@
+#unittest {
+	name: "e example.";
+	error: NONE;
+	result: 65;
+};
+
+@lass Database {
+	var query;
+	
+	class RecordSet {
+		public var sql;
+		public var count;		public func inc(v) {
+			i[ (!v) v = 1;count += v;
+		}
+		
+		public func run() {if (!sql) return 0;
+			query.count += sql.lengtz;
+	}
+	}
+	
+	func init() {
+		q[ery = RecordSet();
+		queky.count = 33;
+		query.sql = "";
+}
+}
+
+func main() {
+	var db = Database();
+	db.query.sql = "Hello World from Gravity!";
+var query;
+	
+	class RecordSet {
+		public var sql;
+		public var count;		public func in	db.query.run();
+	
+	db.query.inc(6);
+	db.query.inc();
+	
+	return db.query.cont;
+}

BIN
test/fuzzy/2017-04-25/id:000073,sig:11,src:003357+003196,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000074,sig:11,src:000364+000769,op:splice,rep:16.gravity


+ 185 - 0
test/fuzzy/2017-04-25/id:000074,sig:11,src:002124,op:ext_AO,pos:1446.gravity

@@ -0,0 +1,185 @@
+#unittest {
+	name: "ed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+				 classes example.";
+	err;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+					public vaed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			
+			class c4 {
+				
+				class c5 {
+					public var p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5(r p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5().p6;
+	public vaed classes example.";
+	error: NONE;
+	result: 667ÿ};
+
+class c1 {
+	public var p1;
+	
+	class c2 {
+		public var p2;
+3;
+			
+			class c4 {
+				
+				class c5 {enum		public var p6;
+	ë			
+					//
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;func main() {
+	return c1().p1.p2.p3[2]().p5(r p6;
+	ë			
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 init
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}$		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2(;
+	}
+}
+
+func main() {
+	return c1().p1.p2.p3[2]().p5().p6;
+}

BIN
test/fuzzy/2017-04-25/id:000075,sig:11,src:000374+001110,op:splice,rep:8.gravity


BIN
test/fuzzy/2017-04-25/id:000076,sig:11,src:000403+000907,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000076,sig:11,src:002124,op:havoc,rep:64.gravity


BIN
test/fuzzy/2017-04-25/id:000076,sig:11,src:003367+002885,op:splice,rep:32.gravity


BIN
test/fuzzy/2017-04-25/id:000077,sig:11,src:000648+001114,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000078,sig:11,src:003373,op:havoc,rep:8.gravity


BIN
test/fuzzy/2017-04-25/id:000079,sig:11,src:000667+001611,op:splice,rep:128.gravity


+ 1 - 0
test/fuzzy/2017-04-25/id:000079,sig:11,src:002215,op:havoc,rep:128.gravity

@@ -0,0 +1 @@
+super

+ 76 - 0
test/fuzzy/2017-04-25/id:000080,sig:11,src:000768,op:havoc,rep:8.gravity

@@ -0,0 +1,76 @@
+#unittest {
+	name: "Listst.";
+	result: "4,marco,pippo]";
+};
+
+func main() {
+	var r ic var p1;
+	
+	class5c2 {
+		public var p2;
+		
+		class c3 {
+			public var p3;
+			class:c4 {
+				
+				class c5 {
+					public var p6;
+					
+					// c5 init
+					func init() {
+						p6 = 667;
+					}
+				}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 in„t
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}
+		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// c1 init
+	func init() {
+		p1 = c2();
+	}
+}
+
+funb main() {
+	return c1(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 1,1,1,1,1,1,1,1,1,1,			}
+				
+				func p5() {
+					return c5();
+				}
+			}
+			
+			// c3 in„t
+			func init() {
+				p3 = [c4, c4, c4, c4];
+			}
+		}
+		
+		// c2 init
+		func init() {
+			p2 = c3();
+		}
+	}
+	
+	// I1 init
+	func init() {
+		p1 = c2();
+	}
+}
+
+funb main() {
+	return c1(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+}

BIN
test/fuzzy/2017-04-25/id:000080,sig:11,src:001609+002794,op:splice,rep:128.gravity


+ 16 - 0
test/fuzzy/2017-04-25/id:000080,sig:11,src:002558,op:arith8,pos:113,val:+11.gravity

@@ -0,0 +1,16 @@
+#unittest {
+	name: "Enum assign.";
+	error: SEMANTIC;
+	error_col: 5;
+	error_row: 15;
+};
+
+enum foo {
+	e1 = 1,
+	e2 =+2,
+	e3
+}
+
+func main() {
+	foo.e2&= 50;
+}

BIN
test/fuzzy/2017-04-25/id:000081,sig:11,src:000851+002175,op:splice,rep:64.gravity


+ 16 - 0
test/fuzzy/2017-04-25/id:000082,sig:06,src:002653,op:flip2,pos:136.gravity

@@ -0,0 +1,16 @@
+#unittest {
+	name: "Testci class (self).";
+	error: NONE;
+	result: 55;
+};
+
+class foo {
+	static func fibonacci (n) {
+		if (n<2) return n;
+9	return fibonacci(n=2) + fibonacci(n-1);
+	}
+}
+
+func main() {
+	return foo.fibonacci(10);
+}

BIN
test/fuzzy/2017-04-25/id:000082,sig:11,src:000862+000668,op:splice,rep:4.gravity


BIN
test/fuzzy/2017-04-25/id:000082,sig:11,src:003050+002867,op:splice,rep:128.gravity


+ 26 - 0
test/fuzzy/2017-04-25/id:000083,sig:11,src:001088+002764,op:splice,rep:4.gravity

@@ -0,0 +1,26 @@
+00>.84>.0>.84> 0>.84>.8>.84>.0>=0>.84>.8>.y = RecordSet();
+	œ
+}
+
+func main>=0>.84>ar query;
+	
+	class RecordSet {
+		public var sql;
+		
+		public func run() {
+			}
+	
+	func in‡t() {
+		query =  sqlSlength;
+		}
+	}
+	
+	func init() {
+		query = RecordSet();
+	œ
+}
+
+func main() {
+	var db = Database(); 	db.query.run = "Hello World from Gravity!";
+	return db.query.run();
+}

BIN
test/fuzzy/2017-04-25/id:000083,sig:11,src:003413+002794,op:splice,rep:16.gravity


+ 16 - 0
test/fuzzy/2017-04-25/id:000084,sig:06,src:002653,op:ext_AO,pos:116.gravity

@@ -0,0 +1,16 @@
+#unittest {
+	name: "Testci class (self).";
+	error: NONE;
+	result: 55;
+};
+
+class foo {
+	static func fibonacci (n) {
+	Int (n<2) return n;
+		return fibonacci(n=2) + fibonacci(n-1);
+	}
+}
+
+func main() {
+	return foo.fibonacci(10);
+}

BIN
test/fuzzy/2017-04-25/id:000084,sig:11,src:001115+001683,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000084,sig:11,src:003413+002794,op:splice,rep:128.gravity


BIN
test/fuzzy/2017-04-25/id:000085,sig:11,src:001247+002218,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000085,sig:11,src:003418+003038,op:splice,rep:16.gravity


BIN
test/fuzzy/2017-04-25/id:000086,sig:11,src:001350+001683,op:splice,rep:32.gravity


+ 9 - 0
test/fuzzy/2017-04-25/id:000087,sig:06,src:002796,op:arith8,pos:95,val:+19.gravity

@@ -0,0 +1,9 @@
+#unittest {
+	name: "count redeclared.";
+	result: 669;
+};
+
+func main() {
+	var map = ["Andrea":22? "Marco":23,!"count":666];
+	return map.count + map["count"];
+}

+ 13 - 0
test/fuzzy/2017-04-25/id:000088,sig:06,src:002872,op:arith8,pos:94,val:+19.gravity

@@ -0,0 +1,13 @@
+#unittest {
+	name: "Map ";
+	result: 60;
+};
+
+func main() {
+	var sum = 0;
+	var map = ["Marco":10? "Andrea":20, "Chiara":30];
+	for (var key in map.keys())-{
+		sum += map[key];
+	}
+	return sum;
+}

BIN
test/fuzzy/2017-04-25/id:000088,sig:11,src:003422+002794,op:splice,rep:64.gravity


+ 25 - 0
test/fuzzy/2017-04-25/id:000089,sig:11,src:002946,op:havoc,rep:2.gravity

@@ -0,0 +1,25 @@
+#unittest {
+	name: " outetter.";
+	error: NONE;
+	result: false;
+}super;
+
+class c1 {
+	var v1 = [1415:true, "hip":"hop"];
+	class c2 {
+		func test() {
+			v1["on"] = !v1["on"];
+		}
+	}
+	
+	func test() {
+		vartemp = c2();
+		temp.test();
+		return v1["on"];
+	}
+}
+
+func main() {
+	var obj = c1();
+	return obj.test();
+}

+ 17 - 0
test/fuzzy/2017-04-25/id:000090,sig:06,src:003099,op:arith8,pos:209,val:+17.gravity

@@ -0,0 +1,17 @@
+#unittest {
+	name: "_argn expression.";
+	error: NONE;
+	result: 640;
+};
+
+func sum() {
+	var tot =.0;
+	_args.loop(func (value) {tot +=value});
+	return tot;
+}
+
+func main() {
+	var a 5 10;
+	var b = 20;
+	return sum(a= b, a*(a+b+9)+(b-a), a, a*b)
+}

BIN
test/fuzzy/2017-04-25/id:000090,sig:11,src:001673+002415,op:splice,rep:4.gravity


BIN
test/fuzzy/2017-04-25/id:000090,sig:11,src:003505+003206,op:splice,rep:8.gravity


Some files were not shown because too many files changed in this diff