bug icon indicating copy to clipboard operation
bug copied to clipboard

Reflection doesn't provide a way to find out values of default arguments

Open scabug opened this issue 13 years ago • 6 comments

We could at least expose the defaultGetter method from NamesDefaults.scala: https://github.com/scala/scala/blob/f5357d98a2adfada4998fcdaea680ddc6d8460f8/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala#L424.

Not sure how invocations will work though, because they might need stuff from lexical scope.

scabug avatar Oct 03 '12 13:10 scabug

Imported From: https://issues.scala-lang.org/browse/SI-6468?orig=1 Reporter: @xeno-by

scabug avatar Oct 03 '12 13:10 scabug

@xeno-by said: Also see http://stackoverflow.com/questions/14034142/how-do-i-access-default-parameter-values-via-scala-reflection

scabug avatar Dec 26 '12 09:12 scabug

@xeno-by said: Put this in TermSymbol.getter or create a new method?

scabug avatar Jan 15 '13 13:01 scabug

@xeno-by said: We don't have time for this in 2.10.1

scabug avatar Feb 04 '13 13:02 scabug

@xeno-by said: Also see http://stackoverflow.com/questions/16939511/instantiating-a-case-class-with-default-args-via-reflection

scabug avatar Jun 05 '13 19:06 scabug

Scala 3 equivalent issue: https://github.com/scala/scala3/discussions/17893

SethTisue avatar Mar 25 '24 14:03 SethTisue