Comments (5)
The title could be "Basic type refinement" or something similar. That means, excluding an atom in the union type if it matches the pattern in a previous case/function/catch/receive clause. Only when there are no guards as a first step.
Actually, I plan to work on this on Wednesday. We have "Hackathon" at work, which means Gradualizer hacking to me. :-)
from gradualizer.
I'm changing the title accordingly.
from gradualizer.
also related to #25
your last example is puzzling. The return type of case
should be the union of the type of the clauses which should still be binary | ( string() | false )
. weird and good finding.
from gradualizer.
@erszcz, you're right that this problem is related to type refinement. Unfortunately, it might take some time before we get to implement this.
That last example is weird. Feel free to add it to test/known_problems/should_fail/ so we can keep better track of it.
from gradualizer.
That last example is weird.
The mystery is solved. I have been tricked by Vim hiding the error indicator, but it did so, cause it couldn't parse a crash report. The problem is gone with 5e1c425 and both examples now behave the same.
The title issue, though, remains valid, but as far as I understand it's going to take a while before it gets solved.
from gradualizer.
Related Issues (20)
- Crash with `Uncaught error: {case_clause, ..` in `typechecker:do_type_check_expr/2`
- Crash with Uncaught error: {badkey, ...} HOT 1
- No clause for gradualizer_lib:pick_value(module()) HOT 2
- No clause of gradualizer_lib:pick_value(any()) HOT 2
- Support the new dynamic() type
- `ok bsr ok` crashes erl_eval:do_apply/7 HOT 4
- An invalid utf32 value can crash eval_bits:eval_exp_field/6
- Crash in gradualizer_fmt:format_type_error: no function_clause_matching
- Crash in typechecker:do_type_check_expr_in/3: bad_key in map_get/2
- Invalid polymorphic code accepted HOT 2
- Support old-style 'catch' keyword HOT 5
- Wrong type in receive...after Timeout
- `binary_to_atom/1` breaks compatibility below OTP 23 HOT 4
- Solving local constraints at each function call to a polymorphic function HOT 6
- support for OTP 26 map comprehensions
- Wrong type location reported?
- Gradualizer can't tell that `m` and `f` don't exist in `erlang:apply(m, f, [some, args])` HOT 2
- Exhaustivity checking issue
- Type representation HOT 2
- How to mention Gradualizer in a paper? HOT 2
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 gradualizer.