Skip to content

@[deprecated_after] only works if @[deprecated] is present #25471

Description

@dy-tea

Describe the bug

@jorgeluismireles noticed in #25466 that x.json2.decode() was not giving out a deprecated warning even though it had @[deprecated_after]. I did a little test, see below.

Reproduction Steps

@[deprecated: 'use d() instead']
fn d1() {
}

@[deprecated_after: '2025-10-10']
fn d2() {
}

@[deprecated: 'use d() instead']
@[deprecated_after: '2025-10-10']
fn d3() {
}

fn main() {
	d1()
	d2()
	d3()
}

Expected Behavior

Should give a warning for all 3 functions.

Current Behavior

❯ v run test.v
test.v:22:2: warning: function `d1` has been deprecated; use d() instead
   20 |
   21 | fn main() {
   22 |     d1()
      |     ~~~~
   23 |     d2()
   24 |     d3()
test.v:24:2: warning: function `d3` has been deprecated since 2025-10-10, it will be an error after 2026-04-08; use d() instead
   22 |     d1()
   23 |     d2()
   24 |     d3()
      |     ~~~~
   25 | }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 e5df2d5

Environment details (OS name and version, etc.)

V full version V 0.4.12 217422d.e5df2d5
OS linux, "CachyOS"
Processor 12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U
Memory 4.52GB/15.31GB
V executable /home/dylan/Repos/v/v
V last modified time 2025-10-10 09:37:17
V home dir OK, value: /home/dylan/Repos/v
VMODULES OK, value: /home/dylan/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/dylan/Repos/v
Git version git version 2.51.0
V git status weekly.2025.41-13-ge5df2d5a
.git/config present true
cc version cc (GCC) 15.2.1 20250813
gcc version gcc (GCC) 15.2.1 20250813
clang version clang version 20.1.8
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (GNU libc) 2.42

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.Unit: CompilerBugs/feature requests, that are related to the V compiler in general.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions