mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Merge pull request #38610 from ThakeeNathees/infer-type-null-error
set parser error when infer type is null
This commit is contained in:
		
						commit
						5046f666a1
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		|  | @ -8005,6 +8005,10 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) { | |||
| 					_set_error("The assigned value doesn't have a set type; the variable type can't be inferred.", v.line); | ||||
| 					return; | ||||
| 				} | ||||
| 				if (expr_type.kind == DataType::BUILTIN && expr_type.builtin_type == Variant::NIL) { | ||||
| 					_set_error("The variable type cannot be inferred because its value is \"null\".", v.line); | ||||
| 					return; | ||||
| 				} | ||||
| 				v.data_type = expr_type; | ||||
| 				v.data_type.is_constant = false; | ||||
| 			} | ||||
|  | @ -8388,6 +8392,10 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { | |||
| 							_set_error("The assigned value doesn't have a set type; the variable type can't be inferred.", lv->line); | ||||
| 							return; | ||||
| 						} | ||||
| 						if (assign_type.kind == DataType::BUILTIN && assign_type.builtin_type == Variant::NIL) { | ||||
| 							_set_error("The variable type cannot be inferred because its value is \"null\".", lv->line); | ||||
| 							return; | ||||
| 						} | ||||
| 						lv->datatype = assign_type; | ||||
| 						lv->datatype.is_constant = false; | ||||
| 					} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Rémi Verschelde
						Rémi Verschelde