You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
whentrue:
# xxx this fails in c, js, vm and gives cgen error in cpp# it should either give CT error or succeed (special casing literal)templatemain=block:
var s1: set[char] = {'a', 'b'}
var s2: set['a'..'z'] = {'a', 'b'}
echo s2 == {'a', 'b'}
static: main()
main()
nim r main
Current Output
vm:true
js:true
c:false
cpp:cgen error:
/Users/timothee/git_clone/nim/timn/build/nimcache/@mt12496.nim.cpp:152:59: error: cast from pointer to smaller type 'tySet_tyChar__PvbCylXV13Xvtg1HZuvI8A' (aka 'unsigned int') loses information
T2_[0] = nimBoolToStr((s2X60gensym1__t4950525754_17 == ((tySet_tyChar__PvbCylXV13Xvtg1HZuvI8A) (TM__PT0bVxrv4y8D21sJjCuaUw_2))));
Expected Output
option 1: CT error (simpler)
option 2: special case literals and return true in this case (using implicit conversion to LHS)
I'm guessing the issue here is that the literal type is pretending to be inferred as set['a'..'z'] but is becoming set[char] somehow. So it's #16270 for literals.
Example 1
nim r main
Current Output
vm:true
js:true
c:false
cpp:cgen error:
Expected Output
option 1: CT error (simpler)
option 2: special case literals and return true in this case (using implicit conversion to LHS)
Example 2
this works fine:
Additional Information
The text was updated successfully, but these errors were encountered: