Skip to content

Commit 30e1aef

Browse files
committed
Harden a condition in Types
1 parent 37c9d42 commit 30e1aef

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ object Types {
20062006

20072007
val idx = typeParams.indexOf(param)
20082008

2009-
if (idx < args.length) {
2009+
if (0 <= idx && idx < args.length) {
20102010
val argInfo = args(idx) match {
20112011
case arg: TypeBounds =>
20122012
val v = param.paramVariance

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ trait Reporting { this: Context =>
133133
def error(msg: => Message, pos: SourcePosition = NoSourcePosition, sticky: Boolean = false): Unit = {
134134
val fullPos = addInlineds(pos)
135135
reporter.report(if (sticky) new StickyError(msg, fullPos) else new Error(msg, fullPos))
136-
if (ctx.settings.YdebugError.value)
137-
Thread.dumpStack()
136+
if ctx.settings.YdebugError.value then Thread.dumpStack()
138137
}
139138

140139
def error(ex: TypeError, pos: SourcePosition): Unit = {

0 commit comments

Comments
 (0)