Skip to content

fully specialized generic failed at array construction #7955

@jangko

Description

@jangko
type
  SBase[T, V] = ref object of RootObj
    val: T
    color: V
  SRC = ref object of SBase[string, int]
  SRD = ref object of SBase[string, int]

var a = SBase[string, int](val: "base", color: 1)
var b = SRC(val: "rc", color: 2)
var c = SRD(val: "rd", color: 3)

var x = [a, b, c] #ok
var y = [b, c, a] #failed
var z = [c, b, a] #failed

what need to be included in the test:

  • the above case
  • secondary form of ref -> e.g. from new(ref someobject)
  • ptr form, and it's secondary form
  • ordinary object -> perhaps generate runtime error because of object slicing

see the evolution of this bug in #7601, #7818, and #7906

note: if possible, uncomment test at block test_t4799_6 of #4799

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions