Repository: intellij-rust/intellij-rust
Issue: Intellij-rust does not show some methods in completion list 

intellij-rust - Version: 0.2.0.2090-173
intellij IDEA community - IC-173.4674.33
OS - ubuntu 17.10
rust stable - 1.25.0

Here is the sample program I'm testing it with,

```rust
fn main() {
    let s: String = "33".to_owned();
    let num: Result<usize, <usize as FromStr>::Err> = s.parse().un // notice this line
```

In the 2nd line, when I do `s.parse().un`, intellij-rust opens a completion list with all the methods for a `Result` enum. `s.parse()` returns a `Result` by the way.

In the completion list that opens up at that point, a few methods are missing. Specifically the following methods are missing in that completion list,

- unwrap
- expect
- unwrap_err
- expect_err
- unwrap_or_default

Is this a bug in intellij-rust or am I doing something incorrectly? Please advise.

**Note**: I have not filed an issue on intellij-rust before. If this is not relevant enough to be posted as an issue here, please let me know. I shall remove it. Thanks.

Changed files:
src/test/kotlin/org/rust/lang/core/type/RsExpressionTypeInferenceTest.kt, src/test/kotlin/org/rust/lang/core/completion/RsCompletionFilteringTest.kt, src/main/kotlin/org/rust/lang/core/types/infer/TypeInference.kt, src/test/kotlin/org/rust/ide/docs/RsQuickNavigationInfoTest.kt, src/main/kotlin/org/rust/lang/core/resolve/ref/RsMethodCallReferenceImpl.kt

diff --git a/src/main/kotlin/org/rust/lang/core/resolve/ref/RsMethodCallReferenceImpl.kt b/src/main/kotlin/org/rust/lang/core/resolve/ref/RsMethodCallReferenceImpl.kt
index 4a916006f..b9392c8cd 100644
--- a/src/main/kotlin/org/rust/lang/core/resolve/ref/RsMethodCallReferenceImpl.kt
+++ b/src/main/kotlin/org/rust/lang/core/resolve/ref/RsMethodCallReferenceImpl.kt
@@ -15,8 +15,10 @@ import org.rust.lang.core.psi.ext.receiver
 import org.rust.lang.core.resolve.*
 import org.rust.lang.core.types.Substitution
 import org.rust.lang.core.types.emptySubstitution
+import org.rust.lang.core.types.infer.containsTyOfClass
 import org.rust.lang.core.types.inference
 import org.rust.lang.core.types.ty.Ty
+import org.rust.lang.core.types.ty.TyUnknown
 import org.rust.lang.core.types.type
 
 
@@ -129,6 +131,9 @@ private fun filterMethodCompletionVariants(
     lookup: ImplLookup,
     receiver: Ty
 ): RsResolveProcessor {
+    // Don't filter partially unknown types
+    if (receiver.containsTyOfClass(TyUnknown::class.java)) return processor
+
     val cache = mutableMapOf<RsImplItem, Boolean>()
     return fun(it: ScopeEntry): Boolean {
         // 1. If not a method (actually a field) or a trait method - just process it
diff --git a/src/main/kotlin/org/rust/lang/core/types/infer/TypeInference.kt b/src/main/kotlin/org/rust/lang/core/types/infer/TypeInference.kt
index 15086f5ba..32f356507 100644
--- a/src/main/kotlin/org/rust/lang/core/types/infer/TypeInference.kt
+++ b/src/main/kotlin/org/rust/lang/core/types/infer/TypeInference.kt
@@ -380,7 +380,7 @@ class RsInferenceContext(
             return when (ty) {
                 is TyInfer.IntVar -> intUnificationTable.findValue(ty) ?: TyInteger.DEFAULT
                 is TyInfer.FloatVar -> floatUnificationTable.findValue(ty) ?: TyFloat.DEFAULT
-                is TyInfer.TyVar -> varUnificationTable.findValue(ty)?.let(::go) ?: ty.origin ?: TyUnknown
+                is TyInfer.TyVar -> varUnificationTable.findValue(ty)?.let(::go) ?: TyUnknown
             }
         }
 
diff --git a/src/test/kotlin/org/rust/ide/docs/RsQuickNavigationInfoTest.kt b/src/test/kotlin/org/rust/ide/docs/RsQuickNavigationInfoTest.kt
index cb12f4a94..8e343e737 100644
--- a/src/test/kotlin/org/rust/ide/docs/RsQuickNavigationInfoTest.kt
+++ b/src/test/kotlin/org/rust/ide/docs/RsQuickNavigationInfoTest.kt
@@ -665,13 +665,13 @@ class RsQuickNavigationInfoTest : RsDocumentationProviderTest() {
 
     fun `test match if let`() = doTest("""
         fn foo() {
-            if let Some(ref foo) = None {
-                *foo
+            if let Some(ref foo) = Some(0) {
+                *foo;
                  //^
             }
         }
     """, """
-        condition binding <b>foo</b>: &amp;T
+        condition binding <b>foo</b>: &amp;i32
     """)
 
     fun `test file 1`() = doTest("""
diff --git a/src/test/kotlin/org/rust/lang/core/completion/RsCompletionFilteringTest.kt b/src/test/kotlin/org/rust/lang/core/completion/RsCompletionFilteringTest.kt
index 192defde5..6fdedeeb5 100644
--- a/src/test/kotlin/org/rust/lang/core/completion/RsCompletionFilteringTest.kt
+++ b/src/test/kotlin/org/rust/lang/core/completion/RsCompletionFilteringTest.kt
@@ -45,4 +45,34 @@ class RsCompletionFilteringTest: RsCompletionTestBase() {
         impl Bound1 for S {}
         fn main() { S.foo()/*caret*/ }
     """)
+
+    fun `test unsatisfied bound not filtered for unknown type`() = doSingleCompletion("""
+        trait Bound {}
+        trait Trait { fn foo(&self) {} }
+        impl<T: Bound> Trait for S1<T> {}
+        struct S1<T>(T);
+        fn main() { S1(SomeUnknownType).f/*caret*/ }
+    """, """
+        trait Bound {}
+        trait Trait { fn foo(&self) {} }
+        impl<T: Bound> Trait for S1<T> {}
+        struct S1<T>(T);
+        fn main() { S1(SomeUnknownType).foo()/*caret*/ }
+    """)
+
+    fun `test unsatisfied bound not filtered for unconstrained type var`() = doSingleCompletion("""
+        trait Bound {}
+        trait Trait { fn foo(&self) {} }
+        impl<T: Bound> Trait for S1<T> {}
+        struct S1<T>(T);
+        fn ty_var<T>() -> T { unimplemented!() }
+        fn main() { S1(ty_var()).f/*caret*/ }
+    """, """
+        trait Bound {}
+        trait Trait { fn foo(&self) {} }
+        impl<T: Bound> Trait for S1<T> {}
+        struct S1<T>(T);
+        fn ty_var<T>() -> T { unimplemented!() }
+        fn main() { S1(ty_var()).foo()/*caret*/ }
+    """)
 }
diff --git a/src/test/kotlin/org/rust/lang/core/type/RsExpressionTypeInferenceTest.kt b/src/test/kotlin/org/rust/lang/core/type/RsExpressionTypeInferenceTest.kt
index 8c72e7b50..68924a849 100644
--- a/src/test/kotlin/org/rust/lang/core/type/RsExpressionTypeInferenceTest.kt
+++ b/src/test/kotlin/org/rust/lang/core/type/RsExpressionTypeInferenceTest.kt
@@ -863,7 +863,7 @@ class RsExpressionTypeInferenceTest : RsTypificationTestBase() {
         }
         fn main() {
             let a = UnknownStruct { f1: 1, ..Default::default() };
-        }                                                  //^ Self
+        }                                                  //^ <unknown>
     """)
 
     fun `test index expr of unresolved path`() = testExpr("""