Repository: hylo-lang/hylo (swift)

Issue:
typealiases aren't
This should compile but does not:

```swift
public type X {
  let a: Int = 32
}

typealias Y = X

fun f(x: X, y: Y) -> Int {
  let c = x.a
  return c + y.a // x.hylo:10.16-17: error: type 'Y' has no member 'a'
}
```

Pull request description:
Fix #936

Patch:
diff --git a/Sources/FrontEnd/TypeChecking/TypeChecker.swift b/Sources/FrontEnd/TypeChecking/TypeChecker.swift
index 3aac1b0e4..459cc8196 100644
--- a/Sources/FrontEnd/TypeChecking/TypeChecker.swift
+++ b/Sources/FrontEnd/TypeChecking/TypeChecker.swift
@@ -2393,6 +2393,8 @@ struct TypeChecker {
       return lookup(stem, memberOf: t.bareType, exposedTo: scopeOfUse)
     case let t as GenericTypeParameterType:
       return lookup(stem, memberOf: t, exposedTo: scopeOfUse)
+    case let t as TypeAliasType:
+      return lookup(stem, memberOf: t, exposedTo: scopeOfUse)
     default:
       break
     }
@@ -2414,8 +2416,6 @@ struct TypeChecker {
       matches = names(introducedIn: t.decl)[stem, default: []]
     case let t as TraitType:
       matches = names(introducedIn: t.decl)[stem, default: []]
-    case let t as TypeAliasType:
-      matches = names(introducedIn: t.decl)[stem, default: []]
     default:
       matches = []
     }
@@ -2461,6 +2461,19 @@ struct TypeChecker {
     return matches
   }
 
+  /// Returns the declarations that introduce a name with given `stem` as member of `nominalScope`
+  /// and are exposed to `scopeOfUse`.
+  private mutating func lookup(
+    _ stem: String, memberOf nominalScope: TypeAliasType,
+    exposedTo scopeOfUse: AnyScopeID
+  ) -> Set<AnyDeclID> {
+    if let d = names(introducedIn: nominalScope.decl)[stem] {
+      return d
+    } else {
+      return lookup(stem, memberOf: nominalScope.aliasee.value, exposedTo: scopeOfUse)
+    }
+  }
+
   /// Returns the declarations that introduce a name with given `stem` in extensions of
   /// `nominalScope` and are exposed to `scopeOfUse`.
   private mutating func lookup(


Test patch:
diff --git a/Tests/HyloTests/TestCases/TypeChecking/NameLookupWithAlias.hylo b/Tests/HyloTests/TestCases/TypeChecking/NameLookupWithAlias.hylo
new file mode 100644
index 000000000..b37fbeecd
--- /dev/null
+++ b/Tests/HyloTests/TestCases/TypeChecking/NameLookupWithAlias.hylo
@@ -0,0 +1,12 @@
+//- typeCheck expecting: success
+
+public type X {
+  public let a: Int = 32
+}
+
+typealias Y = X
+
+fun f(x: X, y: Y) -> Int {
+  let c = x.a
+  return c + y.a
+}
\ No newline at end of file