gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

Excluding a method changes the binding of an alias #278

Closed apblack closed 5 years ago

apblack commented 5 years ago

I think that the spec now does a good job of explaining that alias and exclude clauses are independent. But minigrace still gets this wrong.

There is known-failing test at js/tests/known-failing/traitExclusion_test.grace:

dialect "minitest"

trait a {
    method border { }
    method size { 3 }
}

trait b {
    method color { }
    method size { 2 }
}

class shape {
    use a 
        alias asize = size
    use b alias bsize = size exclude size
    method draw { }
    method publicBsize { bsize }
    method size { asize + bsize }
}

The method bsize should return 2; in the above code it returns 3, because somehow the exclude size clause causes bsize to be bound to the size method from trait a.

kjx commented 5 years ago

checks ... Kernan & slug ("inheritator2") both seem to get this "right"

apblack commented 5 years ago

Kernan & slug ("inheritator2") both seem to get this "right"

Not surprising really — there is no reason for them to replicate my bug.

This is fixed in commit ec28f11

apblack commented 4 years ago

The above test code is now part of t031; the original test is .../tests/retired/t216_traitExclusion_test.grace