bugfix: type converter that converts to bool in 'if' context
This commit is contained in:
parent
220dd54acf
commit
032599c156
11 changed files with 77 additions and 25 deletions
11
tests/accept/compile/tcan_alias_generic.nim
Normal file
11
tests/accept/compile/tcan_alias_generic.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
##
|
||||
## can_alias_generic Nimrod Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
type
|
||||
TGen[T] = object
|
||||
TGen2[T] = TGen[T]
|
||||
|
||||
|
||||
11
tests/accept/compile/tcan_alias_specialised_generic.nim
Normal file
11
tests/accept/compile/tcan_alias_specialised_generic.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
##
|
||||
## can_alias_specialised_generic Nimrod Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
type
|
||||
TGen[T] = object
|
||||
TSpef = TGen[string]
|
||||
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
converter p(i: int): bool = return i != 0
|
||||
|
||||
if 0:
|
||||
echo "foo"
|
||||
if 1:
|
||||
echo if 4: "foo" else: "barr"
|
||||
while 0:
|
||||
echo "bar"
|
||||
|
||||
|
|
|
|||
8
tests/reject/tno_int_in_bool_context.nim
Normal file
8
tests/reject/tno_int_in_bool_context.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
discard """
|
||||
line: 6
|
||||
errormsg: "Error: type mismatch: got (int) but expected 'bool'"
|
||||
"""
|
||||
|
||||
if 1:
|
||||
echo "wtf?"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue