dwango / fialyzer Goto Github PK
View Code? Open in Web Editor NEW[WIP] Faster Implementation of Dialyzer
Home Page: https://dwango.github.io/fialyzer/
License: Apache License 2.0
[WIP] Faster Implementation of Dialyzer
Home Page: https://dwango.github.io/fialyzer/
License: Apache License 2.0
Read PLT file and take BinaryTag types generated from following type contracts:
-spec foo() -> binary().
-spec bar() -> bitstring().
-spec baz(<<_:M, _:_*N>>) -> ok.
introduce the solve function:
type sol = (type_var, typ) Map.t
val solve : sol -> constraint_ -> sol Result.t
type typ =
...
| TyConstraint of typ * constraint_
I thought that this variant of typ
was necessary for implementing the type derivation, but apparently it seems unnecessary.
see also: https://github.com/erlang/otp/blob/OTP-21.1.3/lib/dialyzer/src/dialyzer_typesig.erl#L340-L372
ref #78
ref: #78
{'ok', integer()} | {'error', term()}
e.g.
case x of
[X|XS] -> ...;
[] -> ...
end
introduce the function:
val derive : context -> expr -> (constraint * type) Result.t
rename sol
-> solution
for readability
Decided in the previous fialyzer weekly meeting.
Currently, the data constructor MFA is defined as follows:
type expr =
...
| MFA of expr * expr * expr
However, using 3-tuple of expr
is not good for readability. So, I think that it should be:
type expr =
| MFA of { module_name: expr, function_name: expr, arity: expr }
How do you think? @yoshihiro503 @amutake
#{a => b}
and Map#{a => b}
https://learnyousomeerlang.com/dialyzer#type-inference-and-discrepancies
-module(discrep1).
-export([run/0]).
run() -> some_op(5, you).
some_op(A, B) -> A + B.
Add two variants to Ast_intf.expr
and fix conversions From_erlang.expr_of_erlang_expr
ListCons
or ListNil
[]
shold be ListNil
[<expr> | <expr>]
and [<expr>, ...]
shold be ListCons
Don't support:
support following types:
-1 | 0 | 1
1..255
Fialyzer should know type signatures of BIF (Built-In Function).
see https://github.com/erlang/otp/blob/OTP-21.1.3/lib/dialyzer/src/dialyzer_typesig.erl#L1246-L1737
introduce Plt module that treat dialyzer plt file.
type t
val from_file : filename -> (t, exn) Result.t
introduce the translator:
val code_to_expr : Abstract_format.t -> expr Result.t
For solving constraints generated by case
expressions.
Currently, ast_intf.ml has PatStruct of string list * expr
, which means struct pattern. However, it cannot be implemented since it seems that obeam doesn't support such pattern currently.
implement a derivation rule [Letrec]
Currently, it cannot specify PLT file to run blackbox-tests.
We have to make it possible to specify PLT file because PLT is needed to test various codes.
Currenlty, fialyzer doesn't show line number. To do so, Ast.expr
should have line number.
At first, add line number support for Constant
and Var
.
list comprehension [E_0 || Q_1, ..., Q_k]
implement the function:
val solve_sub : sol -> type -> type -> sol Result.t
ref: #78
Pattern = Expression
form is called match expression
and =
operator is called match operator
.
(NOTICE: case E of ... end
is case expression
, not match expression
)
but match expr is so crazy...
Erlang/OTP 21 [erts-10.1.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
Eshell V10.1.3 (abort with ^G)
1> {A, B} = {1, [Z = 2]}, Z.
2
Currently, variable pattern and universal pattern in top-level function is only supported.
This issue is about adding support for map, literal, tuple, and list pattern.
Add constructors PatNil
and PatCons
to type pattern'.
Rename related module names also.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.