Skip to content

Commit

Permalink
Merge pull request #9943 from som-snytt/issue/12538
Browse files Browse the repository at this point in the history
Avoid NPE for annotation arg
  • Loading branch information
lrytz committed Mar 4, 2022
2 parents 0ef047b + 3eb66a7 commit ce02613
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/typechecker/Typers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3966,7 +3966,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
}

def isDefaultArg(tree: Tree) = tree match {
case treeInfo.Applied(fun, _, _) => fun.symbol.isDefaultGetter
case treeInfo.Applied(fun, _, _) => fun.symbol != null && fun.symbol.isDefaultGetter
case _ => false
}

Expand Down
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/reflect/FastTrack.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class FastTrack[MacrosAndAnalyzer <: Macros with Analyzer](val macros: MacrosAnd
makeBlackbox( materializeWeakTypeTag) { case Applied(_, ttag :: Nil, (u :: _) :: _) => _.materializeTypeTag(u, EmptyTree, ttag.tpe, concrete = false) },
makeBlackbox( materializeTypeTag) { case Applied(_, ttag :: Nil, (u :: _) :: _) => _.materializeTypeTag(u, EmptyTree, ttag.tpe, concrete = true) },
makeBlackbox( ApiUniverseReify) { case Applied(_, ttag :: Nil, (expr :: _) :: _) => c => c.materializeExpr(c.prefix.tree, EmptyTree, expr) },
makeBlackbox( StringContext_f) { case _ => _.interpolateF },
makeBlackbox( StringContext_s) { case _ => _.interpolateS },
makeBlackbox( StringContext_raw) { case _ => _.interpolateRaw },
makeWhitebox( StringContext_f) { case _ => _.interpolateF },
makeWhitebox( StringContext_s) { case _ => _.interpolateS },
makeWhitebox( StringContext_raw) { case _ => _.interpolateRaw },
makeBlackbox(ReflectRuntimeCurrentMirror) { case _ => c => currentMirror(c).tree },
makeWhitebox( QuasiquoteClass_api_apply) { case _ => _.expandQuasiquote },
makeWhitebox(QuasiquoteClass_api_unapply) { case _ => _.expandQuasiquote }
Expand Down
2 changes: 1 addition & 1 deletion src/partest/scala/tools/partest/DirectTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ abstract class DirectTest {
catch {
case t: Exception =>
println(t.getMessage)
t.printStackTrace
t.printStackTrace()
sys.exit(1)
}

Expand Down
6 changes: 6 additions & 0 deletions test/files/pos/t12538.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

// javaVersion: 17+

class C {
@java.lang.Deprecated(since = s"test") var i = 4
}

0 comments on commit ce02613

Please sign in to comment.