Skip to content

REPL fails to issue warnings from parser #13208

@SethTisue

Description

@SethTisue

@dwijnand and I found a case where the compiler issues a warning but the REPL does not:

% scalac -3.head -version
Scala compiler version 3.0.3-RC1-bin-20210728-a28aee1-NIGHTLY-git-a28aee1 -- Copyright 2002-2021, LAMP/EPFL
% scala -3.head -deprecation -source:future
scala> type M[X] = X match { case Int => String case _ => Int }                                                         

scala>                                                                                                                  
% echo 'type M[X] = X match { case Int => String case _ => Int }' > S.scala
% scalac -3.head -deprecation -source:future S.scala
-- Deprecation Warning: S.scala:1:46 -------------------------------------------
1 |type M[X] = X match { case Int => String case _ => Int }
  |                                              ^
  |        `_` is deprecated for wildcard arguments of types: use `?` instead
1 warning found

I'm not sure what the exact conditions are to trigger this or not.

Not all warnings are affected. Here's an example where a -source:future deprecation warning is issued in the REPL as expected:

% scala -3.head -deprecation -source:future
scala> List(1) match { case List[_] => true }                                                                           
-- Deprecation Warning:
1 |List(1) match { case List[_] => true }
  |                          ^
  |        `_` is deprecated for wildcard arguments of types: use `?` instead

I'm not sure if the problem is reproducible without -source:future, but I assume that will become clearer when this is investigated.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions