Opened 4 years ago

Closed 4 years ago

#204 closed defect (fixed)

Conversion cost ignores type parameters

Reported by: f37yu Owned by:
Priority: major Component: cfa-cc
Version: 1.0 Keywords:


The conversionCost function incorrectly produces a cost of zero between parametric types.

with declaration

forall (dtype DT)
struct A;
A(int) aint;

the invalid cast

(A(char)) aint

is accepted by the compiler.

There is an algorithmic error in conversionCost: struct types are already handled in typesCompatible call, which correctly considers type parameters. However, incompatible structs are passed into ConversionCost? pass again which only consider names and not parameters.

Change History (1)

comment:1 Changed 4 years ago by ajbeach

Resolution: fixed
Status: newclosed

Used the suggested fix (simply removing the offending code) and added a test that shows the error.

Commit: 1d179399a54c3ddcecf129adeec6303b1492ddac

Note: See TracTickets for help on using tickets.