Opened 8 months ago

Closed 8 months ago

#235 closed defect (fixed)

Wrong disambiguation in the presence of extra type variables

Reported by: mlbrooks Owned by: Michael Brooks <mlbrooks@…>
Priority: major Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

    forall( dtype T, dtype U )
    struct map {};

    forall( dtype T )
    void f( T & ) {
        printf("f-generic\n");
    }

    forall( dtype T )
    void f( map(T, T) & ) {
        printf("f-specific\n");
    }

    int main() {
        float one;
        map(float, float) two;
        f(one);
        f(two);
    }

Actual output:

f-generic
f-generic

Expected output:

f-generic
f-specific

Change History (1)

comment:1 Changed 8 months ago by Michael Brooks <mlbrooks@…>

Owner: set to Michael Brooks <mlbrooks@…>
Resolution: fixed
Status: newclosed

In fcd0b9d:

PolyCost? calculation result becomes 0 or 1 per type, avoiding double-couting. Fixes #235?

PolyCost? calculation is documented as "Count of parameters and return values bound to some poly type." Before this fix, the cost calculation, looking inside one parameter or return, counted each occurrence of a poly type that it found there. This caused an incorrect increase in PolyCost? on cases like #235 where several type variables are used in the declaration of one parameter.

libcfa/src/concurrency/thread.cfa: Changing a decl-use pattern to keep resolution consistent (no behaviour is changed). The management of defaultResumptionHandler in the thread constructor was benefitting from bug #235 to disambiguate assignment to local variable vs assignment to declared function (due to #234). After this change, the code works around that false ambiguity by using a different name for the local variable.

tests/avl*: Adding a missing assertion on the custom destructor definition. Previously, the destructor definition was benefiting from bug #235 to avoid the missing-assertion-on-custom-dtor problem described in #227.

Note: See TracTickets for help on using tickets.