1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:16:11 -07:00

go/types: minimal support for alias declarations: don't crash

For #16339

Change-Id: I8927f40e0fd166795f41c784ad92449743f73af5
Reviewed-on: https://go-review.googlesource.com/30213
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2016-10-03 13:32:11 -07:00
parent 59c63c711c
commit 316f93f716
3 changed files with 14 additions and 0 deletions

View File

@ -72,6 +72,7 @@ var tests = [][]string{
{"testdata/const1.src"},
{"testdata/constdecl.src"},
{"testdata/vardecl.src"},
{"testdata/aliasdecl.src"},
{"testdata/expr0.src"},
{"testdata/expr1.src"},
{"testdata/expr2.src"},

View File

@ -274,6 +274,9 @@ func (check *Checker) collectObjects() {
check.declare(fileScope, nil, obj, token.NoPos)
}
case *ast.AliasSpec:
check.errorf(s.Name.Pos(), "cannot handle alias declarations yet")
case *ast.ValueSpec:
switch d.Tok {
case token.CONST:

10
src/go/types/testdata/aliasdecl.src vendored Normal file
View File

@ -0,0 +1,10 @@
// Copyright 2016 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 aliasdecl
import "math"
const _ = math.Pi
const c /* ERROR "cannot handle alias declarations yet" */ => math.Pi