From fd04717ecc56d3ca5c6502806377ae1e01e12df6 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 11 Jul 2012 22:29:12 +0400 Subject: [PATCH] added 'hasErrorInConstrainingTypes' not to report type inference error in such cases --- .../lang/resolve/calls/inference/ConstraintsSystem.java | 6 ++++-- .../tests/inference/hasErrorInConstrainingTypes.kt | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java index d21563ed220..c3aeda4ea26 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java @@ -45,10 +45,10 @@ public interface ConstraintsSystem { * @param constrainingType * @param constraintPosition */ - void addSubtypingConstraint(@NotNull JetType subjectType, @NotNull JetType constrainingType, @NotNull ConstraintPosition constraintPosition); + void addSubtypingConstraint(@NotNull JetType subjectType, @Nullable JetType constrainingType, @NotNull ConstraintPosition constraintPosition); // only subject type might contain type variables - void addSupertypeConstraint(@NotNull JetType subjectType, @NotNull JetType constrainingType, @NotNull ConstraintPosition constraintPosition); + void addSupertypeConstraint(@NotNull JetType subjectType, @Nullable JetType constrainingType, @NotNull ConstraintPosition constraintPosition); boolean isSuccessful(); @@ -62,6 +62,8 @@ public interface ConstraintsSystem { boolean hasTypeConstructorMismatchAt(@NotNull ConstraintPosition constraintPosition); + boolean hasErrorInConstrainingTypes(); + @Nullable TypeConstraints getTypeConstraints(@NotNull TypeParameterDescriptor typeParameterDescriptor); diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt new file mode 100644 index 00000000000..facb21165a5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt @@ -0,0 +1,8 @@ +package n + +fun foo(t: T, t1: T) {} + +fun test() { + //no type inference error + foo(aaab, bbb) +} \ No newline at end of file