--- /dev/null
+#![feature(associated_type_defaults)]
+
+// This is a partial regression test for #26681, which used to fail to resolve
+// `Self` in the assoc. constant, and now fails with a type mismatch because
+// `Self::Fv` cannot be assumed to equal `u8` inside the trait.
+
+trait Foo {
+ type Bar;
+}
+
+impl Foo for u8 {
+ type Bar = ();
+}
+
+trait Baz {
+ type Fv: Foo = u8;
+ const C: <Self::Fv as Foo>::Bar = 6665; //~ error: mismatched types
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-26681.rs:17:39
+ |
+LL | const C: <Self::Fv as Foo>::Bar = 6665;
+ | ^^^^ expected associated type, found integer
+ |
+ = note: expected type `<<Self as Baz>::Fv as Foo>::Bar`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.