timotheecour / Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).
http://nim-lang.org/
Other
2 stars 0 forks source link

cast in VM should support more operations that are legal in RT #733

Open timotheecour opened 3 years ago

timotheecour commented 3 years ago

rationale: make code written for C backend work at CT in more cases

example 1

# xxx in VM, gives: Error: VM does not support 'cast' from tyInt to tyFloat
let a = 123456789
let b = cast[float](a)

example 2

tests/misc/tcast.nim:87:21:      # xxx: Error: VM does not support 'cast' from tyEnum to tyEnum
tests/stdlib/thashes.nim:194:29:    disableVm: # xxx Error: VM does not support 'cast' from tyRef to tyPointer
tests/stdlib/tjsonutils.nim:48:18:        # Error: VM does not support 'cast' from tyNil to tyPointer
tests/stdlib/tstrfloats.nim:71:36:        # xxx in VM, gives: Error: VM does not support 'cast' from tyInt to tyFloat
tests/vm/tcastint.nim:120:27:  disableVM: # xxx Error: VM does not support 'cast' from tyInt64 to tyFloat32

example 3

from another PR: VM does not support 'cast' from tyEnum to tyUInt