Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated inline method does not generate deprecation warning #19913

Closed
2m opened this issue Mar 11, 2024 · 2 comments · Fixed by #19914
Closed

Deprecated inline method does not generate deprecation warning #19913

2m opened this issue Mar 11, 2024 · 2 comments · Fixed by #19914
Assignees
Milestone

Comments

@2m
Copy link

2m commented Mar 11, 2024

Compiler version

3.4.0, 3.4.1-RC1, 3.3.3.

Minimized code

Two deprecated methods, one inline.

//> using scala 3.4.0
//> using option -deprecation

object Deprecated:

  @deprecated("test")
  def method() = ???

  @deprecated("test")
  inline def inlineMethod() = ???

object Test:
  Deprecated.method()
  Deprecated.inlineMethod()

Output

Deprecation warning is not shown for the inline method.

[warn] ./depr.sc:13:3
[warn] method method in object Deprecated is deprecated: test
[warn]   Deprecated.method()
[warn]

Expectation

Both deprecated methods generate deprecation warnings. This was noticed in Iltotore/iron#229

@2m 2m added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 11, 2024
@som-snytt
Copy link
Contributor

fwiw this was too much machinery:

#16037

The suggestion there was to move CrossVersionChecks earlier. Unused check runs after typer.

Or maybe original is available to CrossVersionChecks via "inlined body retainer"; I don't remember how that works.

@nicolasstucki nicolasstucki added area:inline and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 11, 2024
@nicolasstucki
Copy link
Contributor

Moving CrossVersionChecks earlier would not help with transparent inline defs. We probably need to check those just before we inline the calls.

@nicolasstucki nicolasstucki self-assigned this Mar 11, 2024
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 11, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes scala#19913
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 11, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes scala#19913
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 11, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes scala#19913
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 11, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes scala#19913
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 19, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes scala#19913
nicolasstucki added a commit that referenced this issue Mar 19, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes #19913


### Changes

- Define `CrossVersionChecks.checkRef` that checks both deprecation and
experimental.
- Used in `Inlines` and `PostTyper` to check the deprecation of inlined
calls.
- Rename `checkDeprecated` to `checkDeprecatedRef`
- Move `checkDeprecatedRef` and `skipWarning` to `object
CrossVersionChecks`
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
@Kordyjan Kordyjan modified the milestones: 3.4.2, 3.5.0 May 10, 2024
WojciechMazur pushed a commit that referenced this issue Jul 3, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes #19913

[Cherry-picked f2ba6f4]
WojciechMazur pushed a commit that referenced this issue Jul 3, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes #19913

[Cherry-picked f2ba6f4]
WojciechMazur pushed a commit that referenced this issue Jul 3, 2024
We must check these constraint just before inlining as later on there on
the call might completely disappear. We do the same as we did for
experimental definition checks.

Fixes #19913

[Cherry-picked f2ba6f4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants