Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for mustTypecheck (0.58 sec)

  1. src/cmd/compile/internal/types2/instantiate_test.go

    			}
    		})
    	}
    }
    
    func TestInstantiateNonEquality(t *testing.T) {
    	const src = "package p; type T[P any] int"
    	pkg1 := mustTypecheck(src, nil, nil)
    	pkg2 := mustTypecheck(src, nil, nil)
    	// We consider T1 and T2 to be distinct types, so their instances should not
    	// be deduplicated by the context.
    	T1 := pkg1.Scope().Lookup("T").Type().(*Named)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 28 17:58:07 UTC 2023
    - 5.8K bytes
    - Viewed (0)
  2. src/go/types/instantiate_test.go

    			}
    		})
    	}
    }
    
    func TestInstantiateNonEquality(t *testing.T) {
    	const src = "package p; type T[P any] int"
    	pkg1 := mustTypecheck(src, nil, nil)
    	pkg2 := mustTypecheck(src, nil, nil)
    	// We consider T1 and T2 to be distinct types, so their instances should not
    	// be deduplicated by the context.
    	T1 := pkg1.Scope().Lookup("T").Type().(*Named)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  3. src/go/types/sizes_test.go

    	return findStructTypeConfig(t, src, &types.Config{})
    }
    
    func findStructTypeConfig(t *testing.T, src string, conf *types.Config) *types.Struct {
    	types_ := make(map[ast.Expr]types.TypeAndValue)
    	mustTypecheck(src, nil, &types.Info{Types: types_})
    	for _, tv := range types_ {
    		if ts, ok := tv.Type.(*types.Struct); ok {
    			return ts
    		}
    	}
    	t.Fatalf("failed to find a struct type in src:\n%s\n", src)
    	return nil
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 21:00:48 UTC 2023
    - 4K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/sizes_test.go

    	return findStructTypeConfig(t, src, &types2.Config{})
    }
    
    func findStructTypeConfig(t *testing.T, src string, conf *types2.Config) *types2.Struct {
    	types := make(map[syntax.Expr]types2.TypeAndValue)
    	mustTypecheck(src, nil, &types2.Info{Types: types})
    	for _, tv := range types {
    		if ts, ok := tv.Type.(*types2.Struct); ok {
    			return ts
    		}
    	}
    	t.Fatalf("failed to find a struct type in src:\n%s\n", src)
    	return nil
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 21:00:48 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types2/named_test.go

    	P int
    }
    
    func (T) M(int) {}
    func (T) N() (i int) { return }
    
    type G[P any] struct {
    	F P
    }
    
    func (G[P]) M(P) {}
    func (G[P]) N() (p P) { return }
    
    type Inst = G[int]
    	`
    	pkg := mustTypecheck(src, nil, nil)
    
    	var (
    		T        = pkg.Scope().Lookup("T").Type()
    		G        = pkg.Scope().Lookup("G").Type()
    		SrcInst  = pkg.Scope().Lookup("Inst").Type()
    		UserInst = mustInstantiate(b, G, Typ[Int])
    	)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 16 21:06:56 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/typestring_test.go

    		if got := typ.String(); got != test.str {
    			t.Errorf("%s: got %s, want %s", test.src, got, test.str)
    		}
    	}
    }
    
    func TestQualifiedTypeString(t *testing.T) {
    	p := mustTypecheck("package p; type T int", nil, nil)
    	q := mustTypecheck("package q", nil, nil)
    
    	pT := p.Scope().Lookup("T").Type()
    	for _, test := range []struct {
    		typ  Type
    		this *Package
    		want string
    	}{
    		{nil, nil, "<nil>"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 28 17:58:07 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  7. src/go/types/named_test.go

    	P int
    }
    
    func (T) M(int) {}
    func (T) N() (i int) { return }
    
    type G[P any] struct {
    	F P
    }
    
    func (G[P]) M(P) {}
    func (G[P]) N() (p P) { return }
    
    type Inst = G[int]
    	`
    	pkg := mustTypecheck(src, nil, nil)
    
    	var (
    		T        = pkg.Scope().Lookup("T").Type()
    		G        = pkg.Scope().Lookup("G").Type()
    		SrcInst  = pkg.Scope().Lookup("Inst").Type()
    		UserInst = mustInstantiate(b, G, Typ[Int])
    	)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 05 16:29:58 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  8. src/go/types/typestring_test.go

    		if got := typ.String(); got != test.str {
    			t.Errorf("%s: got %s, want %s", test.src, got, test.str)
    		}
    	}
    }
    
    func TestQualifiedTypeString(t *testing.T) {
    	p := mustTypecheck("package p; type T int", nil, nil)
    	q := mustTypecheck("package q", nil, nil)
    
    	pT := p.Scope().Lookup("T").Type()
    	for _, test := range []struct {
    		typ  Type
    		this *Package
    		want string
    	}{
    		{nil, nil, "<nil>"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 28 17:58:07 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  9. src/go/types/hilbert_test.go

    	// generate source
    	src := program(*H, *out)
    	if *out != "" {
    		os.WriteFile(*out, src, 0666)
    		return
    	}
    
    	DefPredeclaredTestFuncs() // declare assert (used by code generated by verify)
    	mustTypecheck(string(src), nil, nil)
    }
    
    func program(n int, out string) []byte {
    	var g gen
    
    	g.p(`// Code generated by: go test -run=Hilbert -H=%d -out=%q. DO NOT EDIT.
    
    // +`+`build ignore
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/hilbert_test.go

    	// generate source
    	src := program(*H, *out)
    	if *out != "" {
    		os.WriteFile(*out, src, 0666)
    		return
    	}
    
    	DefPredeclaredTestFuncs() // declare assert (used by code generated by verify)
    	mustTypecheck(string(src), nil, nil)
    }
    
    func program(n int, out string) []byte {
    	var g gen
    
    	g.p(`// Code generated by: go test -run=Hilbert -H=%d -out=%q. DO NOT EDIT.
    
    // +`+`build ignore
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 13 21:00:12 UTC 2023
    - 3.4K bytes
    - Viewed (0)
Back to top