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
class C[E]
var x: E
redef fun to_s
do
if x != null then
return "x is {x.as(not null)}"
end
return "x is null"
end
end
var c1 = new C[nullable Object](null)
var c2 = new C[nullable Int](null)
c1.x = "test"
c2.x = 100
The global compiler will try to inline the message sending when c1.x = .... However, this produce type_test which is unreachable :
$ nitc failing_example.nit --global
nitc__temp.nitgg.1.c: In function‘nitc__temp___core__Sys___main’:
nitc__temp.nitgg.1.c:7419:6: warning: statement will never be executed [-Wswitch-unreachable]
var2 = 1;~~~~~^~~
nitc__temp.nitgg.1.c:7474:6: warning: statement will never be executed [-Wswitch-unreachable]
var7 = 1;~~~~~^~~
nitc__temp.nitgg.1.c:7577:7: warning: statement will never be executed [-Wswitch-unreachable]
var23 = 1;
The C code is generated naively and we do not try to remove dead parts.
Thus silent C compiler warnings about unreachable things.
Closenitlang#2780
Signed-off-by: Jean Privat <[email protected]>
Here's the use case when compiling with
--global
:The global compiler will try to inline the message sending when
c1.x = ...
. However, this produce type_test which is unreachable :The generated C code :
The text was updated successfully, but these errors were encountered: