Comments (7)
@Anton-4 are you working on a fix for this? I would like to give it a shot.
from roc.
No, I've now assigned you to this issue :)
Thanks for your help @eckertliam!
from roc.
Due to the multiple type mismatches this example is pretty difficult so if we can get a simpler case to investigate that would be great :)
from roc.
This might be simpler example:
interface Foo
exposes [bar]
imports []
foo : a, (a -> a) -> a
foo = \x, f -> bar x f
bar : a, (a -> a) -> a
bar = \x, f ->
baz : a
baz = f x
foo x f
It fails with just the single error:
── TYPE MISMATCH in Foo.roc ────────────────────────────────────────────────────
Something is off with the body of the baz definition:
10│ baz : a
11│ baz = f x
^^^
This f call produces:
a
But the type annotation on baz says it should be:
a
────────────────────────────────────────────────────────────────────────────────
1 error and 1 warning found in 26 ms
The error goes away after any of the following changes:
- Remove implementation of
baz
- Remove type annotation of
baz
- Remove type annotation of
bar
- Remove implementation of
foo
from roc.
Awesome, thanks @jwoudenberg :)
from roc.
I don't think either of these should actually be type errors. Unless I'm misunderstanding something I think the programs should compile fine. The issue is that a
in the type annotation is not used in the inner annotations' a
.
from roc.
I wonder if we could add a suggestion? maybe it would be possible to detect this somehow and provide a suggestion like "the types are different even though they are have the same name"
Or perhaps there is a way to prevent this kind of issue by making it invalid to use the same type variable in an inner annotation?
from roc.
Related Issues (20)
- Dead link to LogFormatter.roc in abilities.md HOT 1
- Abilities build error when importing module
- Add HTML page titles and descriptions for roc-lang.org/examples and everything under it. HOT 2
- "connection to server is erroring. Header must provide a Content-Length property” errors in VS Code HOT 6
- library 'System' not found on macOS HOT 1
- Use Inspect to print repl output HOT 1
- Default value fields don't type check for closed records
- Encode.EncoderFormatting and DecoderFormatting do not implement dict HOT 2
- REPL mangles string output on long strings.
- Confusing rules on recursive types
- Consider switching to tabs for indentation HOT 2
- Add function `catch : Result ok err, (err -> a), (ok -> a) -> a` to standard library. HOT 4
- Unhelpful error message for function annotation separated from definition HOT 3
- Newline between type annotation and implementation should "just work" HOT 2
- move everything in getting_started folder to website
- Support ! in pipeline HOT 5
- Invalid "File Not Found" Error HOT 2
- Use yellow underline in warnings
- "An internal compiler expectation was broken" when changing the .roc part of a platform
- An internal compiler expectation was broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roc.