google-research / google-research/dex-lang

Catch instantiation-dependent overlap

Open
#669 2 comments 0 reactions 0 assignees View on GitHub
bug language / type system
Dominant language
Haskell
Stars
1.7k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

```
interface A a
method : a -> Int
instance A Int
method _ = 0
instance A a
method _ = 1

def f (x : a) : Int = method x
```

This is not an error in Dex today, since it can happily commit to the `A a` instance as the only one that satisfies the polymorphic requirements of `method` on the last line. But, if we instantiate `f` at `Int` then we'd probably expect the first instance to trigger! Haskell raises an error in situations like this one and we should too!

Contributor guide

Open the contributing guide

Research direction

Start by tracing instance resolution for the provided Dex example, especially how the polymorphic call to method is committed before f is instantiated at Int. Done means Dex rejects the instantiation-dependent overlap, matching the stated Haskell-like behavior; the payload names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.