ethlts / solcore

experimental solidity compiler
0 stars 1 forks source link

Oddity with nested phantom types. #21

Open ekpyron opened 1 week ago

ekpyron commented 1 week ago

This works:

data Memory(a) = Memory(Word)

function g() {
    let x : Memory(Memory(Word));
    x = Memory(0);
}

while this fails:

data Memory(a) = Memory(Word)

function g() {
    let x : Memory(Memory(Word)) = Memory(0);
}

with

Types do not match: Memory(Word) and b
 - in:let x :: Memory(Memory(Word)) = Memory(0) ;

Am I missing something here? I'd have expected the latter to work as well.

rodrigogribeiro commented 1 week ago

Fixed on main.

ekpyron commented 1 week ago

For me on main now in fact both cases no longer work ;-).

In the first case I get

Types Memory(b) and Memory(Memory(Word)) do not match
 - in:x = Memory(0) ;

in the second

Types Memory(b) and Memory(Memory(Word)) do not match
 - in:let x :: Memory(Memory(Word)) = Memory(0) ;

(and even the simpler let x : Memory(Word) = Memory(0); no longer works now ;-))

rodrigogribeiro commented 3 days ago

This is now fixed at main. Please confirm either by running cabal new-test or by running the compiler over the files test/examples/cases/Memory1.solc and test/examples/cases/Memory2.solc.