Skip to content

Commit

Permalink
Semantic: fix Self generic resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Mar 13, 2024
1 parent 5f4936c commit d839dd0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/typecheck/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Context, InstanceScope } from '../scope'
import { fold } from '../util/array'
import { merge } from '../util/map'
import { assert, unreachable } from '../util/todo'
import { VirtualFnType, VirtualType, genericToVirtual } from './index'
import { VirtualFnType, VirtualType } from './index'
import { holeType, selfType } from './type'

export const makeFnGenericMap = (fnType: VirtualFnType, argTypes: VirtualType[]): Map<string, VirtualType> => {
Expand Down Expand Up @@ -146,12 +146,7 @@ export const getTypeParams = (virtualType: VirtualType): VirtualType[] => {
}

export const instanceGenericMap = (instScope: InstanceScope, ctx: Context): Map<string, VirtualType> => {
// TODO: virtual generics should already be contained in InstanceRelation, check in other places too
const generics = instScope.rel.instanceDef.generics.map(g => {
const vg = genericToVirtual(g, ctx)
return <const>[vg.name, vg]
})
return new Map([[selfType.name, instScope.selfType], ...generics])
return new Map([[selfType.name, instScope.selfType]])
}

/**
Expand Down

0 comments on commit d839dd0

Please sign in to comment.