403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/go/src/internal/types/testdata/fixedbugs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/go/src/internal/types/testdata/fixedbugs/issue53650.go
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package p

import (
	"reflect"
	"testing"
)

type T1 int
type T2 int

func f[P T1 | T2, _ []P]() {}

var _ = f[T1]

// test case from issue

type BaseT interface {
	Type1 | Type2
}
type BaseType int
type Type1 BaseType
type Type2 BaseType // float64

type ValueT[T BaseT] struct {
	A1 T
}

func NewType1() *ValueT[Type1] {
	r := NewT[Type1]()
	return r
}
func NewType2() *ValueT[Type2] {
	r := NewT[Type2]()
	return r
}

func NewT[TBase BaseT, TVal ValueT[TBase]]() *TVal {
	ret := TVal{}
	return &ret
}
func TestGoType(t *testing.T) {
	r1 := NewType1()
	r2 := NewType2()
	t.Log(r1, r2)
	t.Log(reflect.TypeOf(r1), reflect.TypeOf(r2))
	fooT1(r1.A1)
	fooT2(r2.A1)
}

func fooT1(t1 Type1) {

}
func fooT2(t2 Type2) {

}

Youez - 2016 - github.com/yon3zu
LinuXploit