Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
696df0eb
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
696df0eb
编写于
5月 11, 2012
作者:
S
Svetlana Isakova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more tests for KT-1897
#KT-1897 fixed
上级
3528822d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
11 deletion
+31
-11
compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java
...rc/org/jetbrains/jet/lang/resolve/calls/CallResolver.java
+3
-3
compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ValueArgumentsToParametersMapper.java
.../lang/resolve/calls/ValueArgumentsToParametersMapper.java
+6
-6
compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.jet
...agnostics/tests/checkArguments/kt1897_diagnostic_part.jet
+22
-2
未找到文件。
compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java
浏览文件 @
696df0eb
...
...
@@ -416,7 +416,7 @@ public class CallResolver {
checkTypesWithNoCallee
(
context
.
toBasic
());
return
;
}
checkUn
known
ArgumentTypes
(
context
.
toBasic
(),
unmappedArguments
);
checkUn
mapped
ArgumentTypes
(
context
.
toBasic
(),
unmappedArguments
);
}
List
<
JetTypeProjection
>
jetTypeArguments
=
context
.
call
.
getTypeArguments
();
...
...
@@ -612,8 +612,8 @@ public class CallResolver {
}
}
private
void
checkUn
knownArgumentTypes
(
BasicResolutionContext
context
,
Set
<
ValueArgument
>
unknown
Arguments
)
{
for
(
ValueArgument
valueArgument
:
un
known
Arguments
)
{
private
void
checkUn
mappedArgumentTypes
(
BasicResolutionContext
context
,
Set
<
ValueArgument
>
unmapped
Arguments
)
{
for
(
ValueArgument
valueArgument
:
un
mapped
Arguments
)
{
JetExpression
argumentExpression
=
valueArgument
.
getArgumentExpression
();
if
(
argumentExpression
!=
null
)
{
expressionTypingServices
.
getType
(
context
.
scope
,
argumentExpression
,
NO_EXPECTED_TYPE
,
context
.
trace
);
...
...
compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ValueArgumentsToParametersMapper.java
浏览文件 @
696df0eb
...
...
@@ -101,7 +101,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
if
(
valueParameterDescriptor
==
null
)
{
temporaryTrace
.
report
(
NAMED_PARAMETER_NOT_FOUND
.
on
(
nameReference
));
unmappedArguments
.
add
(
valueArgument
);
status
=
ERROR
;
status
=
WEAK_
ERROR
;
}
else
{
temporaryTrace
.
record
(
REFERENCE_TARGET
,
nameReference
,
valueParameterDescriptor
);
...
...
@@ -116,14 +116,14 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
}
if
(
somePositioned
)
{
temporaryTrace
.
report
(
MIXING_NAMED_AND_POSITIONED_ARGUMENTS
.
on
(
nameReference
));
status
=
ERROR
;
status
=
WEAK_
ERROR
;
}
}
else
{
somePositioned
=
true
;
if
(
someNamed
)
{
temporaryTrace
.
report
(
MIXING_NAMED_AND_POSITIONED_ARGUMENTS
.
on
(
valueArgument
.
asElement
()));
status
=
ERROR
;
status
=
WEAK_
ERROR
;
}
else
{
int
parameterCount
=
valueParameters
.
size
();
...
...
@@ -147,7 +147,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
else
{
temporaryTrace
.
report
(
TOO_MANY_ARGUMENTS
.
on
(
valueArgument
.
asElement
(),
candidate
));
unmappedArguments
.
add
(
valueArgument
);
status
=
WEAK_
ERROR
;
status
=
ERROR
;
}
}
}
...
...
@@ -179,7 +179,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
else
{
if
(!
usedParameters
.
add
(
valueParameterDescriptor
))
{
temporaryTrace
.
report
(
TOO_MANY_ARGUMENTS
.
on
(
possiblyLabeledFunctionLiteral
,
candidate
));
status
=
ERROR
;
status
=
WEAK_
ERROR
;
}
else
{
status
=
status
.
compose
(
put
(
candidateCall
,
valueParameterDescriptor
,
CallMaker
.
makeValueArgument
(
functionLiteral
),
varargs
));
...
...
@@ -190,7 +190,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
for
(
int
i
=
1
;
i
<
functionLiteralArguments
.
size
();
i
++)
{
JetExpression
argument
=
functionLiteralArguments
.
get
(
i
);
temporaryTrace
.
report
(
MANY_FUNCTION_LITERAL_ARGUMENTS
.
on
(
argument
));
status
=
ERROR
;
status
=
WEAK_
ERROR
;
}
}
...
...
compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.jet
浏览文件 @
696df0eb
//
KT
-
1897
When
call
cannot
be
resolved
to
any
function
,
save
information
about
types
of
arguments
package
a
fun
foo
(<
!UNUSED_PARAMETER!>i<!>: Int, <!UNUSED_PARAMETER!>s<!>: String) {
}
fun
bar
()
{}
fun
foo
(<
!UNUSED_PARAMETER!>i<!>: Int, <!UNUSED_PARAMETER!>s<!>: String) {}
fun
test
()
{
bar
(<
!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>xx<!>)
bar
<
!TOO_MANY_ARGUMENTS, DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED!>{ }<!>
foo
(<
!TYPE_MISMATCH!>""<!>, <!ERROR_COMPILE_TIME_VALUE!>1<!>, <!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>xx<!>)
foo
(<
!NAMED_PARAMETER_NOT_FOUND!>r<!> = <!UNRESOLVED_REFERENCE!>xx<!>, i = <!TYPE_MISMATCH!>""<!>, s = "")
foo
(
i
=
1
,
<
!ARGUMENT_PASSED_TWICE!>i<!> = 1, s = <!ERROR_COMPILE_TIME_VALUE!>11<!>)
foo
(<
!TYPE_MISMATCH!>""<!>, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>s<!> = <!ERROR_COMPILE_TIME_VALUE!>2<!>)
foo
(
i
=
<
!TYPE_MISMATCH!>""<!>, s = <!ERROR_COMPILE_TIME_VALUE!>2<!>, <!MIXING_NAMED_AND_POSITIONED_ARGUMENTS!>33<!>)
foo
(<
!TYPE_MISMATCH!>""<!>, <!ERROR_COMPILE_TIME_VALUE!>1<!>) <!TOO_MANY_ARGUMENTS!>{}<!>
foo
(<
!TYPE_MISMATCH!>""<!>, <!ERROR_COMPILE_TIME_VALUE!>1<!>) <!TOO_MANY_ARGUMENTS!>{}<!> <!MANY_FUNCTION_LITERAL_ARGUMENTS!>{}<!>
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录