Skip to content

Commit

Permalink
go1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Oct 19, 2023
1 parent f56162e commit 8aaba9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 94 deletions.
14 changes: 6 additions & 8 deletions cl/func_type_and_var.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ func toParam(ctx *blockCtx, fld *ast.Field, args []*gox.Param) []*gox.Param {
func toType(ctx *blockCtx, typ ast.Expr) types.Type {
switch v := typ.(type) {
case *ast.Ident:
if enableTypeParams {
ctx.idents = append(ctx.idents, v)
defer func() {
ctx.idents = ctx.idents[:len(ctx.idents)-1]
}()
}
ctx.idents = append(ctx.idents, v)
defer func() {
ctx.idents = ctx.idents[:len(ctx.idents)-1]
}()
typ := toIdentType(ctx, v)
if enableTypeParams && ctx.inInst == 0 {
if ctx.inInst == 0 {
if t, ok := typ.(*types.Named); ok {
if namedIsTypeParams(ctx, t) {
pos := ctx.idents[0].Pos()
Expand Down Expand Up @@ -142,7 +140,7 @@ func toType(ctx *blockCtx, typ ast.Expr) types.Type {
return toFuncType(ctx, v, nil, nil)
case *ast.SelectorExpr:
typ := toExternalType(ctx, v)
if enableTypeParams && ctx.inInst == 0 {
if ctx.inInst == 0 {
if t, ok := typ.(*types.Named); ok {
if namedIsTypeParams(ctx, t) {
panic(ctx.newCodeErrorf(v.Pos(), "cannot use generic type %v without instantiation", t.Obj().Type()))
Expand Down
5 changes: 0 additions & 5 deletions cl/types_go118.go → cl/typeparams.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18

/*
* Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved.
*
Expand All @@ -26,8 +23,6 @@ import (
"github.com/goplus/gop/token"
)

const enableTypeParams = true

func toTermList(ctx *blockCtx, expr ast.Expr) []*types.Term {
retry:
switch v := expr.(type) {
Expand Down
81 changes: 0 additions & 81 deletions cl/types_go117.go

This file was deleted.

0 comments on commit 8aaba9d

Please sign in to comment.