File tree 2 files changed +16
-3
lines changed
compiler/src/dotty/tools/dotc/transform
tests/neg-custom-args/fatal-warnings
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -204,12 +204,15 @@ class CheckUnused extends MiniPhase:
204
204
case t: tpd.ValDef =>
205
205
prepareForValDef(t)
206
206
traverseChildren(tree)(using newCtx)
207
+ transformValDef(t)
207
208
case t: tpd.DefDef =>
208
209
prepareForDefDef(t)
209
210
traverseChildren(tree)(using newCtx)
211
+ transformDefDef(t)
210
212
case t: tpd.TypeDef =>
211
213
prepareForTypeDef(t)
212
214
traverseChildren(tree)(using newCtx)
215
+ transformTypeDef(t)
213
216
case t : tpd.Bind =>
214
217
prepareForBind(t)
215
218
traverseChildren(tree)(using newCtx)
@@ -332,7 +335,7 @@ object CheckUnused:
332
335
* The optional name will be used to target the right import
333
336
* as the same element can be imported with different renaming
334
337
*/
335
- def registerUsed (sym : Symbol , name : Option [Name ])(using Context ): Unit =
338
+ def registerUsed (sym : Symbol , name : Option [Name ])(using Context ): Unit =
336
339
if ! isConstructorOfSynth(sym) && ! doNotRegister(sym) then
337
340
if sym.isConstructor && sym.exists then
338
341
registerUsed(sym.owner, None ) // constructor are "implicitly" imported with the class
@@ -368,7 +371,7 @@ object CheckUnused:
368
371
implicitParamInScope += memDef
369
372
else
370
373
explicitParamInScope += memDef
371
- else if currScopeType.top == ScopeType .Local then
374
+ else if currScopeType.top == ScopeType .Local then
372
375
localDefInScope += memDef
373
376
else if memDef.shouldReportPrivateDef then
374
377
privateDefInScope += memDef
Original file line number Diff line number Diff line change @@ -75,6 +75,16 @@ package foo.test.companionprivate:
75
75
private def b = c // OK
76
76
def c = List (1 ,2 ,3 ) // OK
77
77
78
+ package foo .test .i16678:
79
+ def foo (func : Int => String , value : Int ): String = func(value) // OK
80
+
81
+ def run =
82
+ println(foo(number => number.toString, value = 5 )) // OK
83
+ println(foo(number => " <number>" , value = 5 )) // error
84
+ println(foo(func = number => " <number>" , value = 5 )) // error
85
+ println(foo(func = number => number.toString, value = 5 )) // OK
86
+ println(foo(func = _.toString, value = 5 )) // OK
87
+
78
88
package foo .test .possibleclasses:
79
89
case class AllCaseClass (
80
90
k : Int , // OK
@@ -120,4 +130,4 @@ package foo.test.from.i16675:
120
130
case class PositiveNumber private (i : Int ) // OK
121
131
object PositiveNumber :
122
132
def make (i : Int ): Option [PositiveNumber ] = // OK
123
- Option .when(i >= 0 )(PositiveNumber (i)) // OK
133
+ Option .when(i >= 0 )(PositiveNumber (i)) // OK
You can’t perform that action at this time.
0 commit comments