Godot: Statically typing a value as int and assigning a float to does not emit a warning

Created on 17 Aug 2020  路  3Comments  路  Source: godotengine/godot

Godot version:

3.2.2-stable

OS/device including version:

Windows 10 Home 2004

Issue description:

https://github.com/godotengine/godot-proposals/issues/1383
Expected a warning.

Steps to reproduce:

  1. var x := 1
  2. x = 0.25

Minimal reproduction project:

bug gdscript

Most helpful comment

@Sslaxx Making the inferred type display on hover (like in VS Code) is probably the way to go.

All 3 comments

Conversely, if it were var x:= 1.0 it would work.

It'd be nice if in the editor Godot could tell you what type of variable that := would produce, in addition to the fact that warnings about type conversion (especially for inferred types) would be useful.

Something along the lines of this (excusing my poor image manip skills, and hoping this gets across what I mean): Demo

@Sslaxx Making the inferred type display on hover (like in VS Code) is probably the way to go.

(Off topic) not to mention, Dictionary key-value types.

Was this page helpful?
0 / 5 - 0 ratings