A method for the direct correlation at the nanoscale of structural and optical properties of single GaAs nanowires is reported. Nanowires consisting of 100% wurtzite and nanowires presenting zinc-blende/wurtzite polytypism are investigated by photoluminescence spectroscopy and transmission electron microscopy. The photoluminescence of wurtzite GaAs is consistent with a band gap of 1.5 eV. In the polytypic nanowires, it is shown that the regions that are predominantly composed of either zinc-blende or wurtzite phase show photoluminescence emission close to the bulk GaAs band gap, while regions composed of a nonperiodic superlattice of wurtzite and zinc-blende phases exhibit a redshift of the photoluminescence spectra as low as 1.455 eV. The dimensions of the quantum heterostructures are correlated with the light emission, allowing us to determine the band alignment between these two crystalline phases. Our first-principles electronic structure calculations within density functional theory, employing a hybrid-exchange functional, predict band offsets and effective masses in good agreement with experimental results.