File tree 1 file changed +2
-1
lines changed
src/compiler/scala/tools/nsc/typechecker
1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -871,7 +871,8 @@ trait Namers extends MethodSynthesis {
871
871
private def widenIfNecessary (sym : Symbol , tpe : Type , pt : Type ): Type = {
872
872
// Are we inferring the result type of a stable symbol, whose type doesn't refer to a hidden symbol?
873
873
// If we refer to an inaccessible symbol, let's hope widening will result in an expressible type.
874
- val mayKeepSingletonType = sym.isStable && ! refersToSymbolLessAccessibleThan(tpe, sym)
874
+ // (A LiteralType should be widened because it's too precise for a definition's type.)
875
+ val mayKeepSingletonType = ! tpe.isInstanceOf [LiteralType ] && sym.isStable && ! refersToSymbolLessAccessibleThan(tpe, sym)
875
876
876
877
// Only final vals may be constant folded, so deconst inferred type of other members.
877
878
@ inline def keepSingleton = if (sym.isFinal) tpe else tpe.deconst
You can’t perform that action at this time.
0 commit comments