This is an example of foreshadowing. This is when the plot gives you details, so in this case the nightmare, that symbolizes a dreadful event will take place sometime later in the story. Foreshadowing is a technique used to hint at something that will transpire in the story and the foreshadowing nearly always appears at the beginning of the story.