parent
fa3d19b477
commit
9ecb24e443
2 changed files with 27 additions and 4 deletions
|
|
@ -143,8 +143,8 @@ proc checkConvertible(c: PContext, targetTyp: PType, src: PNode): TConvStatus =
|
||||||
|
|
||||||
if d == nil:
|
if d == nil:
|
||||||
result = convNotLegal
|
result = convNotLegal
|
||||||
elif d.kind == tyObject and s.kind == tyObject:
|
elif d.skipTypes(abstractInst).kind == tyObject and s.skipTypes(abstractInst).kind == tyObject:
|
||||||
result = checkConversionBetweenObjects(d, s, pointers)
|
result = checkConversionBetweenObjects(d.skipTypes(abstractInst), s.skipTypes(abstractInst), pointers)
|
||||||
elif (targetBaseTyp.kind in IntegralTypes) and
|
elif (targetBaseTyp.kind in IntegralTypes) and
|
||||||
(srcBaseTyp.kind in IntegralTypes):
|
(srcBaseTyp.kind in IntegralTypes):
|
||||||
if targetTyp.isOrdinalType:
|
if targetTyp.isOrdinalType:
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ discard """
|
||||||
17
|
17
|
||||||
(width: 0.0, taste: "", color: 13)
|
(width: 0.0, taste: "", color: 13)
|
||||||
(width: 0.0, taste: "", color: 15)
|
(width: 0.0, taste: "", color: 15)
|
||||||
cool'''
|
cool
|
||||||
|
test'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# bug #5241
|
# bug #5241
|
||||||
|
|
@ -62,4 +63,26 @@ method m[T](o: Foo[T]) = echo "cool"
|
||||||
|
|
||||||
var v: Bar
|
var v: Bar
|
||||||
v.new()
|
v.new()
|
||||||
v.m() # Abstract method not called anymore
|
v.m() # Abstract method not called anymore
|
||||||
|
|
||||||
|
|
||||||
|
# bug #88
|
||||||
|
|
||||||
|
type
|
||||||
|
TGen[T] = object of RootObj
|
||||||
|
field: T
|
||||||
|
|
||||||
|
TDerived[T] = object of TGen[T]
|
||||||
|
nextField: T
|
||||||
|
|
||||||
|
proc doSomething[T](x: ref TGen[T]) =
|
||||||
|
type
|
||||||
|
Ty = ref TDerived[T]
|
||||||
|
echo Ty(x).nextField
|
||||||
|
|
||||||
|
var
|
||||||
|
x: ref TDerived[string]
|
||||||
|
new(x)
|
||||||
|
x.nextField = "test"
|
||||||
|
|
||||||
|
doSomething(x)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue