From bf6398820971fb0133c53a86e6835ee0f549c35b Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 31 Mar 2015 14:02:51 +0200 Subject: SI-8731 don't issue a @switch warning for two-case matches This allows annotating small pattern matches with `@switch` without getting any warnings. There's no reason to warn, the performance of the generated bytecode is good. --- src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/compiler/scala/tools/nsc/transform/patmat') diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala index b703b5bc6d..e1fe220556 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala @@ -577,8 +577,6 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging { lengthMax3(casesNoSubstOnly) > 2 } val requireSwitch = hasSwitchAnnotation && exceedsTwoCasesOrAlts - if (hasSwitchAnnotation && !requireSwitch) - reporter.warning(scrut.pos, "matches with two cases or fewer are emitted using if-then-else instead of switch") (suppression, requireSwitch) case _ => (Suppression.NoSuppression, false) -- cgit v1.2.3