Ticket #22 (closed defect: fixed)
Code Generation bug with Generics and bool
| Reported by: | hopscc | Owned by: | Chuck |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Cobra Compiler | Version: | 0.8.0 |
| Keywords: | Cc: |
Description
This code
s = Stack<of bool>() s.push(true) s.push(true) s.push(true) tf = false tf = s.pop to ! # ==> compile fail
gives a compiler error from the c# compiler:
...Bug.cobra(7): error: "bool" does not contain a definition for "Value" (C#)
Compilation failed - 1 error.
This code gives a warning but seems to compile and run OK.
s = Stack<of bool>() s.push(true) s.push(true) s.push(true) tf = false tf = s.pop to bool # ==> warning change to 'to !' assert tf==true
Bug.cobra(7): warning: The given expression is already a "bool", but nilable. You can just use "to !".
Compilation succeeded - 1 warning
Doing the same using a tmp variable compiles and runs AOK:
s = Stack<of bool>()
s.push(true)
s.push(true)
s.push(true)
tf = false
b = s.pop
tf = b to !
assert tf==true
So whats the beef
with the first version ?
Change History
Note: See
TracTickets for help on using
tickets.
