Skip to content

Commit 9809850

Browse files
committed
Merge branch 'main' into domain-keys-in-map
2 parents 24cd780 + b26ae51 commit 9809850

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1647
-575
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5454
with:
5555
fetch-depth: 50
56-
- uses: erlef/setup-beam@8aa8a857c6be0daae6e97272bb299d5b942675a4 # v1.19.0
56+
- uses: erlef/setup-beam@75edbb82877ab10edeb12a99c3cf2f0909f3dc87 # v1.20.1
5757
with:
5858
otp-version: ${{ matrix.otp_version }}
5959
- name: Set ERL_COMPILER_OPTIONS
@@ -114,7 +114,7 @@ jobs:
114114
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115115
with:
116116
fetch-depth: 50
117-
- uses: erlef/setup-beam@8aa8a857c6be0daae6e97272bb299d5b942675a4 # v1.19.0
117+
- uses: erlef/setup-beam@75edbb82877ab10edeb12a99c3cf2f0909f3dc87 # v1.20.1
118118
with:
119119
otp-version: ${{ matrix.otp_version }}
120120
- name: Compile Elixir

.github/workflows/notify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2020
with:
2121
fetch-depth: 50
22-
- uses: erlef/setup-beam@8aa8a857c6be0daae6e97272bb299d5b942675a4 # v1.19.0
22+
- uses: erlef/setup-beam@75edbb82877ab10edeb12a99c3cf2f0909f3dc87 # v1.20.1
2323
with:
2424
otp-version: "27.3"
2525
elixir-version: "1.18.3"

.github/workflows/release.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ jobs:
113113

114114
sign:
115115
needs: [build]
116+
environment: release
116117
strategy:
117118
fail-fast: true
118119
matrix:
@@ -126,30 +127,28 @@ jobs:
126127

127128
permissions:
128129
contents: write
130+
id-token: write
129131

130132
steps:
131133
- name: "Download build"
132134
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
133135
with:
134136
name: build-${{ matrix.flavor }}-elixir-otp-${{ matrix.otp }}
135137

138+
- name: Log in to Azure
139+
if: ${{ matrix.flavor == 'windows' && vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
140+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
141+
with:
142+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
143+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
144+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
136145
- name: "Sign files with Trusted Signing"
137146
uses: azure/trusted-signing-action@0d74250c661747df006298d0fb49944c10f16e03 # v0.5.1
138-
if: github.repository == 'elixir-lang/elixir' && matrix.flavor == 'windows'
147+
if: ${{ matrix.flavor == 'windows' && vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
139148
with:
140-
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
141-
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
142-
# AZURE_TENANT_ID and AZURE_CLIENT_ID should stay the same,
143-
# but AZURE_CLIENT_SECRET has expiration date. When it expires go to
144-
# App Registrations / <app> / Certificates & secrets,
145-
# click (+) New client secret, note the "Value" (not "Secret ID")
146-
# and update it:
147-
#
148-
# $ gh --repo elixir-lang/elixir secret set AZURE_CLIENT_SECRET
149-
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
150149
endpoint: https://eus.codesigning.azure.net/
151-
trusted-signing-account-name: trusted-signing-elixir
152-
certificate-profile-name: Elixir
150+
trusted-signing-account-name: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
151+
certificate-profile-name: ${{ vars.AZURE_CERTIFICATE_PROFILE_NAME }}
153152
files-folder: ${{ github.workspace }}
154153
files-folder-filter: exe
155154
file-digest: SHA256

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ The type system was made possible thanks to a partnership between [CNRS](https:/
4646

4747
#### Elixir
4848

49-
* [File] `File.stream!(path, modes, lines_or_bytes)` is deprecated in favor of the correct order in `File.stream!(path, lines_or_bytes, modes)`
49+
* [File] `File.stream!(path, modes, lines_or_bytes)` is deprecated in favor of `File.stream!(path, lines_or_bytes, modes)`
5050
* [Kernel] Matching on the size inside a bit pattern now requires the pin operator for consistency, such as `<<x::size(^existing_var)>>`
51-
* [Kernel.ParallelCompiler] `Kernel.ParallelCompiler.async/1` is deprecated in favor of `Kernel.ParallelCompiler.pmap/2`, which is more performant and deals better with edge cases
51+
* [Kernel.ParallelCompiler] `Kernel.ParallelCompiler.async/1` is deprecated in favor of `Kernel.ParallelCompiler.pmap/2`, which is more performant and addresses known limitations
5252

5353
#### Logger
5454

lib/eex/lib/eex.ex

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ defmodule EEx do
118118
| {:expr | :start_expr | :middle_expr | :end_expr, marker, charlist, metadata}
119119
| {:eof, metadata}
120120

121+
@type tokenize_opt ::
122+
{:file, binary()}
123+
| {:line, line}
124+
| {:column, column}
125+
| {:indentation, non_neg_integer}
126+
| {:trim, boolean()}
127+
128+
@type compile_opt ::
129+
tokenize_opt
130+
| {:engine, module()}
131+
| {:parser_options, Code.parser_opts()}
132+
| {atom(), term()}
133+
121134
@doc """
122135
Generates a function definition from the given string.
123136
@@ -128,6 +141,7 @@ defmodule EEx do
128141
template.
129142
130143
The supported `options` are described [in the module docs](#module-options).
144+
Additional options are passed to the underlying engine.
131145
132146
## Examples
133147
@@ -220,7 +234,7 @@ defmodule EEx do
220234
"3"
221235
222236
"""
223-
@spec compile_string(String.t(), keyword) :: Macro.t()
237+
@spec compile_string(String.t(), [compile_opt]) :: Macro.t()
224238
def compile_string(source, options \\ []) when is_binary(source) and is_list(options) do
225239
case tokenize(source, options) do
226240
{:ok, tokens} ->
@@ -259,7 +273,7 @@ defmodule EEx do
259273
#=> "3"
260274
261275
"""
262-
@spec compile_file(Path.t(), keyword) :: Macro.t()
276+
@spec compile_file(Path.t(), [compile_opt]) :: Macro.t()
263277
def compile_file(filename, options \\ []) when is_list(options) do
264278
filename = IO.chardata_to_string(filename)
265279
options = Keyword.merge([file: filename, line: 1], options)
@@ -277,7 +291,7 @@ defmodule EEx do
277291
"foo baz"
278292
279293
"""
280-
@spec eval_string(String.t(), keyword, keyword) :: String.t()
294+
@spec eval_string(String.t(), keyword, [compile_opt]) :: String.t()
281295
def eval_string(source, bindings \\ [], options \\ [])
282296
when is_binary(source) and is_list(bindings) and is_list(options) do
283297
compiled = compile_string(source, options)
@@ -299,7 +313,7 @@ defmodule EEx do
299313
#=> "foo baz"
300314
301315
"""
302-
@spec eval_file(Path.t(), keyword, keyword) :: String.t()
316+
@spec eval_file(Path.t(), keyword, [compile_opt]) :: String.t()
303317
def eval_file(filename, bindings \\ [], options \\ [])
304318
when is_list(bindings) and is_list(options) do
305319
filename = IO.chardata_to_string(filename)
@@ -339,7 +353,7 @@ defmodule EEx do
339353
Note new tokens may be added in the future.
340354
"""
341355
@doc since: "1.14.0"
342-
@spec tokenize([char()] | String.t(), opts :: keyword) ::
356+
@spec tokenize([char()] | String.t(), [tokenize_opt]) ::
343357
{:ok, [token()]} | {:error, String.t(), metadata()}
344358
def tokenize(contents, opts \\ []) do
345359
EEx.Compiler.tokenize(contents, opts)

lib/eex/lib/eex/engine.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ defmodule EEx.Engine do
1717
@doc """
1818
Called at the beginning of every template.
1919
20+
It receives the options during compilation, including the
21+
ones managed by EEx, such as `:line` and `:file`, as well
22+
as custom engine options.
23+
2024
It must return the initial state.
2125
"""
2226
@callback init(opts :: keyword) :: state

lib/elixir/lib/calendar.ex

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ defmodule Calendar do
162162
"""
163163
@type time_zone_database :: module()
164164

165+
@typedoc """
166+
Options for formatting dates and times with `strftime/3`.
167+
"""
168+
@type strftime_opts :: [
169+
preferred_datetime: String.t(),
170+
preferred_date: String.t(),
171+
preferred_time: String.t(),
172+
am_pm_names: (:am | :pm -> String.t()) | (:am | :pm, map() -> String.t()),
173+
month_names: (pos_integer() -> String.t()) | (pos_integer(), map() -> String.t()),
174+
abbreviated_month_names:
175+
(pos_integer() -> String.t()) | (pos_integer(), map() -> String.t()),
176+
day_of_week_names: (pos_integer() -> String.t()) | (pos_integer(), map() -> String.t()),
177+
abbreviated_day_of_week_names:
178+
(pos_integer() -> String.t()) | (pos_integer(), map() -> String.t())
179+
]
180+
165181
@doc """
166182
Returns how many days there are in the given month of the given year.
167183
"""
@@ -617,7 +633,7 @@ defmodule Calendar do
617633
618634
"""
619635
@doc since: "1.11.0"
620-
@spec strftime(map(), String.t(), keyword()) :: String.t()
636+
@spec strftime(map(), String.t(), strftime_opts()) :: String.t()
621637
def strftime(date_or_time_or_datetime, string_format, user_options \\ [])
622638
when is_map(date_or_time_or_datetime) and is_binary(string_format) do
623639
parse(

lib/elixir/lib/calendar/duration.ex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,22 @@ defmodule Duration do
161161
"""
162162
@type duration :: t | [unit_pair]
163163

164+
@typedoc """
165+
Options for `Duration.to_string/2`.
166+
"""
167+
@type to_string_opts :: [
168+
units: [
169+
year: String.t(),
170+
month: String.t(),
171+
week: String.t(),
172+
day: String.t(),
173+
hour: String.t(),
174+
minute: String.t(),
175+
second: String.t()
176+
],
177+
separator: String.t()
178+
]
179+
164180
@microseconds_per_second 1_000_000
165181

166182
@doc """
@@ -436,6 +452,7 @@ defmodule Duration do
436452
437453
"""
438454
@doc since: "1.18.0"
455+
@spec to_string(t, to_string_opts) :: String.t()
439456
def to_string(%Duration{} = duration, opts \\ []) do
440457
units = Keyword.get(opts, :units, [])
441458
separator = Keyword.get(opts, :separator, " ")

0 commit comments

Comments
 (0)