And the LORD God called unto Adam, and said unto him, Where art thou?
And he said, I heard thy voice in the garden, and I was afraid, because I was naked; and I hid myself.
And he said, Who told thee that thou wast naked? Hast thou eaten of the tree, whereof I commanded thee that thou shouldest not eat? Genesis 3:9-11
In Genesis 2:17, God told Adam not to eat from the tree of the knowledge of good and evil.
But of the tree of the knowledge of good and evil, thou shalt not eat of it: for in the day that thou eatest thereof thou shalt surely die. Genesis 2:17
So when God heard Adam say he was naked in Genesis 3:10, he knew Adam had eaten from the tree of knowlege. How else would he know he was naked?
Which all makes perfect sense.
Except according to Genesis 2:17, Adam wouldn't just know things (like that he was naked), he'd also be dead.