scala / scala/scala3

Give a concrete definition of trivial methods and update the way they are identified in the CheckUnused phase

Open
#16,640 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:linting itype:enhancement stat:needs spec
Dominant language
Scala
Stars
6.3k
Forks
1.2k
Avg merge
1d 17h
Merged PRs (30d)
126

Description

In #16157, -Wunused:params do not report trivial methods. These are currently identified as in Scala 2, i.e. by checking if their right hand side type is either: a constant type, single type, a literal, etc. See this comment.

The idea is to give a concrete formal definition of trivial methods, and update the code that identify them here .

Here's an idea of a trivial method:

def foo(a: Int, b: String) = ???

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with compiler/src/dotty/tools/dotc/transform/CheckUnused.scala at the linked identification code and review the discussion in #16157. Compare the current Scala 2-style checks with the proposed formal definition of trivial methods. Done means the definition is concrete and the CheckUnused phase identifies methods accordingly for -Wunused:params.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.