@@ -150,39 +150,32 @@ trait TypeAssigner {
150
150
val name = tree.name
151
151
val p = nme.primitive
152
152
name match
153
- case p.arrayApply => return MethodType (defn.IntType :: Nil , arrayElemType)
154
- case p.arrayUpdate => return MethodType (defn.IntType :: arrayElemType :: Nil , defn.UnitType )
155
- case p.arrayLength => return MethodType (Nil , defn.IntType )
153
+ case p.arrayApply => MethodType (defn.IntType :: Nil , arrayElemType)
154
+ case p.arrayUpdate => MethodType (defn.IntType :: arrayElemType :: Nil , defn.UnitType )
155
+ case p.arrayLength => MethodType (Nil , defn.IntType )
156
156
// Note that we do not need to handle calls to Array[T]#clone() specially:
157
157
// The JLS section 10.7 says "The return type of the clone method of an array type
158
158
// T[] is T[]", but the actual return type at the bytecode level is Object which
159
159
// is casted to T[] by javac. Since the return type of Array[T]#clone() is Array[T],
160
160
// this is exactly what Erasure will do.
161
161
case _ =>
162
-
163
- val pre = maybeSkolemizePrefix(qualType, name)
164
- val mbr = qualType.findMember(name, pre)
165
- if (reallyExists(mbr))
166
- qualType.select(name, mbr)
167
- else if (qualType.isErroneous || name.toTermName == nme.ERROR )
168
- UnspecifiedErrorType
169
- else if couldInstantiateTypeVar(qualType) then
170
- // try again with more defined qualifier type
171
- selectionType(tree, qual1)
172
- else if (name == nme.CONSTRUCTOR )
173
- errorType(ex " $qualType does not have a constructor " , tree.srcPos)
174
- else
175
- NoType
162
+ val pre = maybeSkolemizePrefix(qualType, name)
163
+ val mbr = qualType.findMember(name, pre)
164
+ if reallyExists(mbr) then qualType.select(name, mbr)
165
+ else if qualType.isErroneous || name.toTermName == nme.ERROR then UnspecifiedErrorType
166
+ else NoType
176
167
}
177
168
178
169
def importSuggestionAddendum (pt : Type )(using Context ): String = " "
179
170
180
171
def notAMember (tree : untpd.Select , qual : Tree )(using Context ): ErrorType =
181
- val kind = if tree.isType then " type" else " value"
182
172
val qualType = qual.tpe.widenIfUnstable
173
+ def kind = if tree.isType then " type" else " value"
183
174
def addendum = err.selectErrorAddendum(tree, qual, qualType, importSuggestionAddendum)
184
- errorType(NotAMember (qualType, tree.name, kind, addendum), tree.srcPos)
185
-
175
+ val msg : Message =
176
+ if tree.name == nme.CONSTRUCTOR then ex " $qualType does not have a constructor "
177
+ else NotAMember (qualType, tree.name, kind, addendum)
178
+ errorType(msg, tree.srcPos)
186
179
187
180
/** The type of the selection in `tree`, where `qual1` is the typed qualifier part.
188
181
* The selection type is additionally checked for accessibility.
0 commit comments