Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux in-mum-web1333.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u141265441 ( 141265441)
PHP Version : 8.4.3
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Directory :  /proc/self/root/opt/golang/1.22.0/src/cmd/gofmt/testdata/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/opt/golang/1.22.0/src/cmd/gofmt/testdata/typeswitch.golden
/*
Parenthesized type switch expressions originally
accepted by gofmt must continue to be rewritten
into the correct unparenthesized form.

Only type-switches that didn't declare a variable
in the type switch type assertion and which
contained only "expression-like" (named) types in their
cases were permitted to have their type assertion parenthesized
by go/parser (due to a weak predicate in the parser). All others
were rejected always, either with a syntax error in the
type switch header or in the case.

See also issue 4470.
*/
package p

func f() {
	var x interface{}
	switch x.(type) { // should remain the same
	}
	switch x.(type) { // should become: switch x.(type) {
	}

	switch x.(type) { // should remain the same
	case int:
	}
	switch x.(type) { // should become: switch x.(type) {
	case int:
	}

	switch x.(type) { // should remain the same
	case []int:
	}

	// Parenthesized (x.(type)) in type switches containing cases
	// with unnamed (literal) types were never permitted by gofmt;
	// thus there won't be any code in the wild using this style if
	// the code was gofmt-ed.
	/*
		switch (x.(type)) {
		case []int:
		}
	*/

	switch t := x.(type) { // should remain the same
	default:
		_ = t
	}

	// Parenthesized (x.(type)) in type switches declaring a variable
	// were never permitted by gofmt; thus there won't be any code in
	// the wild using this style if the code was gofmt-ed.
	/*
		switch t := (x.(type)) {
		default:
			_ = t
		}
	*/
}

Al-HUWAITI Shell