@@ -227,6 +227,42 @@ export class Reference {
227227 }
228228 }
229229
230+ if ( qualifierType instanceof ContractTy ) {
231+ const methodRef = qualifier . node . parent ?. type === "method_call_expression"
232+
233+ if ( qualifier . node . type === "identifier" ) {
234+ const resolved = Reference . resolve ( new NamedNode ( qualifier . node , qualifier . file ) )
235+ if ( resolved instanceof Contract ) {
236+ // found `Contract.fromCell` case
237+ const fromCellName = "AnyContract_fromCell"
238+ const fromCell = index . elementByName ( IndexKey . Funs , fromCellName )
239+ if ( fromCell ) {
240+ const newState = state . withValue (
241+ "search-name" ,
242+ "AnyContract_" + this . element . name ( ) ,
243+ )
244+ if ( ! proc . execute ( fromCell , newState ) ) return false
245+ }
246+
247+ const fromSliceName = "AnyContract_fromSlice"
248+ const fromSlice = index . elementByName ( IndexKey . Funs , fromSliceName )
249+ if ( fromSlice ) {
250+ const newState = state . withValue (
251+ "search-name" ,
252+ "AnyContract_" + this . element . name ( ) ,
253+ )
254+ if ( ! proc . execute ( fromSlice , newState ) ) return false
255+ }
256+ }
257+ }
258+
259+ const nodeContract = index . elementByName ( IndexKey . Primitives , "AnyContract" )
260+ if ( nodeContract && ( methodRef || state . get ( "completion" ) ) ) {
261+ const contractPrimitiveTy = new PrimitiveTy ( "AnyContract" , nodeContract , null )
262+ if ( ! this . processType ( qualifier , contractPrimitiveTy , proc , state ) ) return false
263+ }
264+ }
265+
230266 if ( qualifierType instanceof BouncedTy ) {
231267 return this . processType ( qualifier , qualifierType . innerTy , proc , state )
232268 }
@@ -575,7 +611,8 @@ export class Reference {
575611 if ( node . withSelf ( ) ) return true // don't add methods to unqualified completion
576612 if (
577613 node . name ( ) . startsWith ( "AnyStruct_" ) ||
578- node . name ( ) . startsWith ( "AnyMessage_" )
614+ node . name ( ) . startsWith ( "AnyMessage_" ) ||
615+ node . name ( ) . startsWith ( "AnyContract_" )
579616 ) {
580617 // this functions in fact static methods
581618 return true
0 commit comments