tov / dssl2

A data structures student language, version 2
MIT License
9 stars 4 forks source link

Nested Higher-Order Contract Oddities #31

Open stamourv opened 3 years ago

stamourv commented 3 years ago

Appears to require at least one of them to be defined in DSSL2 code (i.e, not built in).

#lang dssl2

class NotVec[K]:
    def __init__(self):
        pass

# this works
def foo(x: NotVec?):
    pass
foo(NotVec[VecC[num?]]())

# this works too
def foo2(x: NotVec?[num?]):
    pass
foo2(NotVec[num?]())

# this does not, contract violation
def foo3(x: NotVec?[VecC[num?]]):
    pass
foo3(NotVec[VecC[num?]]())

# this also works, different higher-order contract
def bar (x: FunC[num?, num?]):
    pass
bar(λ x: x)