@@ -56,11 +56,12 @@ object FunctionInspection {
5656 if (param != null ) {
5757 val paramType = param.guessType(context)
5858 if (! paramTypeCheck(pi, param, context)) {
59+ val pDeclaredType = pi.ty
5960 val diagnostic = Diagnostic ()
60- diagnostic.message = if (paramType is TyClass && paramType .isInterface) {
61- " Type mismatch '${paramType.displayName} ' not match interface '${paramType .displayName} '"
61+ diagnostic.message = if (pDeclaredType is TyClass && pDeclaredType .isInterface) {
62+ " Type mismatch '${paramType.displayName} ' not match interface '${pDeclaredType .displayName} '"
6263 } else {
63- " Type mismatch '${paramType.displayName} ' not match type '${paramType .displayName} '"
64+ " Type mismatch '${paramType.displayName} ' not match type '${pDeclaredType .displayName} '"
6465 }
6566 diagnostic.severity = Severity .makeSeverity(DiagnosticsOptions .parameterValidation)
6667 diagnostic.range = param.textRange.toRange(file)
@@ -85,7 +86,11 @@ object FunctionInspection {
8586 }
8687 }
8788
88- private fun paramTypeCheck (param : LuaParamInfo , variable : LuaTypeGuessable , context : SearchContext ): Boolean {
89+ private fun paramTypeCheck (
90+ param : LuaParamInfo ,
91+ variable : LuaTypeGuessable ,
92+ context : SearchContext
93+ ): Boolean {
8994 val variableType = variable.guessType(context)
9095 val defineType = param.ty
9196
@@ -105,7 +110,11 @@ object FunctionInspection {
105110 return typeCheck(defineType, variableType, context)
106111 }
107112
108- private fun typeCheck (defineType : ITy , variableType : ITy , context : SearchContext ): Boolean {
113+ private fun typeCheck (
114+ defineType : ITy ,
115+ variableType : ITy ,
116+ context : SearchContext ,
117+ ): Boolean {
109118 if (DiagnosticsOptions .anyTypeCanAssignToAnyDefineType && variableType is TyUnknown ) {
110119 return true
111120 }
0 commit comments