Commit Graph
4685 Commits
Author SHA1 Message Date
Theodor Fiedler bc5cf4c4db Consolidate spelling of life cycle (#13541) 2024-05-06 11:56:13 +02:00
José Valim 0043b1e1af Use dynamic(type) on pretty printing 2024-05-05 15:29:42 +02:00
José Valim 6b4291645c Warn on undefined exceptions 2024-05-04 20:41:51 +02:00
José Valim 5acdb97403 Type check rescued exceptions 2024-05-04 20:41:51 +02:00
José Valim 5cbea01734 Remove more hardcoded dynamic conversions 2024-05-04 17:37:23 +02:00
Jean Klingler 27164e33be Add Kernel.is_non_struct_map/1 guard (#13534) 2024-05-04 23:59:12 +09:00
José Valim 7489ce8572 Perform type checking across comparison operators (#13527) 2024-05-02 14:09:41 +02:00
José Valim a7673c6c7e Add initial type checking for guards and %expr{} in patterns 2024-05-02 10:05:41 +02:00
José Valim 426fe7dd67 Remove type hint added after rebase 2024-05-01 11:36:15 +02:00
José Valim ce922c2d8f Improve typing error messages 2024-05-01 09:04:03 +02:00
Jean Klingler e557b10c4f Remove dot hint when the issue is a missing key in a map (#13519) 2024-04-30 22:19:45 +02:00
José Valim 017481da6f Properly infer open and closed maps 2024-04-30 18:49:17 +02:00
José Valim d8906c3ddc Track simple variable assignment in type system 2024-04-30 15:59:58 +02:00
José Valim 514355f3d9 Type inference for structs and type checking for dot/remote (#13518)
We now warn:

* `expr.field` when `expr` may not be a map
* `expr.call()` when `expr` may not be an atom
* `expr.call(...)` when `expr` may not be an atom
* `&expr.foo/1` when `expr` may not be an atom

Furthermore, we lay down the ground work for checking undefined
and deprecation warnings across unions. For example, if you write
this code:

    mod = if something?, do: Foo, else: Bar
    mod.some_function()

In the future, it will warn if any of Foo OR Bar do not define the relevant function.
Finally, we improve pretty printing of maps and aliases in types.
2024-04-30 14:15:32 +02:00
José Valim a1743d49ff Return if the key is optional on map_get 2024-04-29 18:29:41 +02:00
José Valim e6254668e3 Use explicit open_map and closed_map functions 2024-04-29 16:36:40 +02:00
José Valim 1ea2dfa05c Fix unmatched branch in map emptiness check 2024-04-29 15:43:56 +02:00
Guillaume Duboc 5911a98c3c Map types representation (#13512) 2024-04-29 13:37:38 +02:00
Jean Klingler cb9c303bc0 Add GenServer.format_status/1 callback (#13511) 2024-04-25 00:08:22 +09:00
José Valim 67c3ad5196 Add brackets around keyword lists when formatting with when, closes #13503 2024-04-23 09:34:03 +02:00
José Valim 883e0c250b Fix warning on import test 2024-04-23 09:28:52 +02:00
José Valim 61cc5f6fcf Simplify internal storage of regex options 2024-04-15 21:56:33 +02:00
Jean Klingler dc6fa24edd Inline duration building in shift/2 functions (#13489)
* Inline duration building in shift/2 functions

* Rename __duration__! and define in all modules
2024-04-10 12:57:26 +09:00
Jean Klingler 98719ff200 Inline some pure functions calls (#13483) 2024-04-08 22:54:03 +09:00
Theodor Fiedler 1b8a34a5c3 Separate Duration date and time unit specs (#13480) 2024-04-07 10:33:02 +02:00
Theodor Fiedler c76b8c13f9 Add t:Duration.duration/0 and simplify shift/2 (#13476) 2024-04-05 12:46:06 +02:00
Andrea Leopardi 3a06089aec Add Kernel.to_timeout/1 (#13468) 2024-04-04 20:23:01 +02:00
Jean Klingler afab3f7da8 Make Duration.new!/1 return an ArgumentError on invalid unit (#13469) 2024-04-04 14:38:39 +02:00
Theodor Fiedler 38f62a8543 Implement Duration and shift/2 for calendar types (#13385) 2024-04-04 12:27:33 +02:00
Theodor Fiedler 53bf241b04 Translate :undefined URI port to nil (#13464)
Resolves #13462

When a url string is schema less and the host is followed by a colon
without setting the actual port, `:uri_string.parse/1` returns the
port to be `:undefined`. As long as the url string is parseable,
we should translate `:undefined` to `nil`, in order to ensure we return
a valid URI struct.
2024-04-02 09:02:31 +02:00
José Valim 12f62e49ca Re-add simplified purging logic (#13455) 2024-03-30 18:30:42 +01:00
José Valim 494a018abb Ensure invalid only/except does not raise on define_import 2024-03-25 11:27:20 +01:00
José Valim ac844f4dba Add Macro.Env.define_import/4 2024-03-24 22:29:30 +01:00
José Valim 206a81bc64 Refactor elixir_import to work with ok/error tuples
Also do not raise if an import conflicts with a special form,
instead, discard it.
2024-03-24 22:29:30 +01:00
José Valim be2e26f465 Add define_alias, define_require, and expand_alias 2024-03-22 19:11:59 +01:00
José Valim 097eee9d5f Add Macro.Env.expand_import/5 and Macro.Env.expand_require/6 (#13421) 2024-03-21 10:51:10 +01:00
Jean Klingler 3da9af2150 Only infer size in pinned variable when needed (#13423) 2024-03-20 18:59:21 +09:00
Jean Klingler 349321117e Log :$process_label in Task crash report (#13406) 2024-03-16 19:05:47 +09:00
José Valim e0ad0c020b Fix warnings in test suite 2024-03-14 22:05:20 +01:00
Guillaume Duboc ce2210ce74 Add compatibility relation for gradual typechecking (#13407) 2024-03-12 19:15:17 +01:00
Nathan Long a37c9e2d67 Allow setting process labels (#13394)
Support setting a process label compatible with Erlang/OTP 27+.
2024-03-12 17:50:32 +01:00
José Valim b8f069d08e Fix parsing of ambiguous operators followed by containers
Closes #13402.
2024-03-09 11:17:06 +01:00
Tiago Moraes f9a139b7f8 Check exports on compile time context modules (#13400) 2024-03-08 18:47:23 +01:00
Jean Klingler 46317841c8 Use System.otp_release/0 in tests for consistency (#13397) 2024-03-06 21:18:35 +09:00
Jean Klingler 844881197c Replace deprecated :code.lib_dir/2 usages (#13395) 2024-03-06 19:00:32 +09:00
José Valim 103faafcd0 Discard mermaid fenced blocks from ansi docs 2024-03-01 11:17:34 +01:00
José Valim 729115420a Skip IEx eval smoke test on Windows and Erlang/OTP 26 (#13377) 2024-02-29 17:05:22 +01:00
José Valim 9dcdc1a5b2 Add get_in/1 with safe nil-handling for access and structs (#13370) 2024-02-27 08:04:36 +01:00
José Valim d120affb11 Emit defmodule tracing event 2024-02-26 18:28:40 +01:00
Jean Klingler 3c55db78f0 Use Erlang's implementation of jaro distance, fix bugs (#13369)
* Use Erlang's implementation of jaro distance, fix bugs

* Remove conditional compilation
2024-02-26 19:25:31 +09:00