• Matthew Dempsky's avatar
    cmd/compile: fix ICE due to bad rune width · 706b54bb
    Matthew Dempsky authored
    It was possible that
    
        var X interface{} = 'x'
    
    could cause a compilation failure due to having not calculated rune's
    width yet. typecheck.go normally calculates the width of things, but
    it doesn't for implicit conversions to default type. We already
    compute the width of all of the standard numeric types in universe.go,
    but we failed to calculate it for the rune alias type. So we could
    later crash if the code never otherwise explicitly mentioned 'rune'.
    
    While here, explicitly compute widths for 'byte' and 'error' for
    consistency.
    
    Fixes #29350.
    
    Change-Id: Ifedd4899527c983ee5258dcf75aaf635b6f812f8
    Reviewed-on: https://go-review.googlesource.com/c/155380Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    706b54bb
universe.go 11.2 KB