Repository: Qiskit/qiskit

Issue:
Error converting QASM with a phase gate on it
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: 0.15.2
- **Python version**: 3.7.8
- **Operating system**: Linux 4.15.0-117-generic (IQX Quantum Lab)

### What is the current behavior?

When converting a QASM circuit using `QuantumCircuit.from_qasm_str`, if the QASM contains a [phase gate](https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/libs/qelib1.inc#L24) it fails during the ast to dag conversion with the next error:

```
AttributeError: 'UniversalUnitary' object has no attribute 'name'
```

### Steps to reproduce the problem

Run the next example:

```
from qiskit import QuantumCircuit

qasm = """
OPENQASM 2.0;
include "qelib1.inc";
qreg q[1];

p(0) q[0];
"""
quantum_circuit = QuantumCircuit.from_qasm_str(qasm)
```


### What is the expected behavior?

To get a QuantumCircuit equal to the next one:
```
from qiskit import QuantumCircuit

circuit = QuantumCircuit(1)
circuit.p(0, 0)
```

### Suggested solutions

n/a



Discussion:

Resolving patch:
diff --git a/qiskit/converters/ast_to_dag.py b/qiskit/converters/ast_to_dag.py
--- a/qiskit/converters/ast_to_dag.py
+++ b/qiskit/converters/ast_to_dag.py
@@ -34,11 +34,15 @@
 from qiskit.circuit.library.standard_gates.i import IGate
 from qiskit.circuit.library.standard_gates.s import SGate
 from qiskit.circuit.library.standard_gates.s import SdgGate
+from qiskit.circuit.library.standard_gates.sx import SXGate
+from qiskit.circuit.library.standard_gates.sx import SXdgGate
 from qiskit.circuit.library.standard_gates.t import TGate
 from qiskit.circuit.library.standard_gates.t import TdgGate
+from qiskit.circuit.library.standard_gates.p import PhaseGate
 from qiskit.circuit.library.standard_gates.u1 import U1Gate
 from qiskit.circuit.library.standard_gates.u2 import U2Gate
 from qiskit.circuit.library.standard_gates.u3 import U3Gate
+from qiskit.circuit.library.standard_gates.u import UGate
 from qiskit.circuit.library.standard_gates.x import XGate
 from qiskit.circuit.library.standard_gates.y import YGate
 from qiskit.circuit.library.standard_gates.z import ZGate
@@ -53,6 +57,9 @@
 from qiskit.circuit.library.standard_gates.rx import CRXGate
 from qiskit.circuit.library.standard_gates.ry import CRYGate
 from qiskit.circuit.library.standard_gates.rz import CRZGate
+from qiskit.circuit.library.standard_gates.p import CPhaseGate
+from qiskit.circuit.library.standard_gates.sx import CSXGate
+from qiskit.circuit.library.standard_gates.u import CUGate
 
 
 def ast_to_dag(ast):
@@ -99,6 +106,8 @@ class AstInterpreter:
     standard_extension = {"u1": U1Gate,
                           "u2": U2Gate,
                           "u3": U3Gate,
+                          "u": UGate,
+                          "p": PhaseGate,
                           "x": XGate,
                           "y": YGate,
                           "z": ZGate,
@@ -106,6 +115,8 @@ class AstInterpreter:
                           "tdg": TdgGate,
                           "s": SGate,
                           "sdg": SdgGate,
+                          "sx": SXGate,
+                          "sxdg": SXdgGate,
                           "swap": SwapGate,
                           "rx": RXGate,
                           "rxx": RXXGate,
@@ -121,7 +132,10 @@ class AstInterpreter:
                           "crx": CRXGate,
                           "cry": CRYGate,
                           "crz": CRZGate,
+                          "csx": CSXGate,
                           "cu1": CU1Gate,
+                          "cp": CPhaseGate,
+                          "cu": CUGate,
                           "cu3": CU3Gate,
                           "ccx": CCXGate,
                           "cswap": CSwapGate}


Test patch:
diff --git a/test/python/circuit/test_circuit_load_from_qasm.py b/test/python/circuit/test_circuit_load_from_qasm.py
--- a/test/python/circuit/test_circuit_load_from_qasm.py
+++ b/test/python/circuit/test_circuit_load_from_qasm.py
@@ -62,6 +62,8 @@ def test_loading_all_qelib1_gates(self):
         ref_circuit.id(0)
         ref_circuit.cx(0, 1)
         # the standard single qubit gates
+        ref_circuit.u(0.2, 0.1, 0.6, 0)
+        ref_circuit.p(0.6, 0)
         ref_circuit.x(0)
         ref_circuit.y(0)
         ref_circuit.z(0)
@@ -70,6 +72,8 @@ def test_loading_all_qelib1_gates(self):
         ref_circuit.t(0)
         ref_circuit.sdg(0)
         ref_circuit.tdg(0)
+        ref_circuit.sx(0)
+        ref_circuit.sxdg(0)
         # the standard rotations
         ref_circuit.rx(0.1, 0)
         ref_circuit.ry(0.1, 0)
@@ -82,8 +86,11 @@ def test_loading_all_qelib1_gates(self):
         ref_circuit.cy(0, 1)
         ref_circuit.cz(0, 1)
         ref_circuit.ch(0, 1)
+        ref_circuit.csx(0, 1)
         ref_circuit.cu1(0.6, 0, 1)
         ref_circuit.cu3(0.2, 0.1, 0.6, 0, 1)
+        ref_circuit.cp(0.6, 0, 1)
+        ref_circuit.cu(0.2, 0.1, 0.6, 0, 0, 1)
         ref_circuit.ccx(0, 1, 2)
         ref_circuit.crx(0.6, 0, 1)
         ref_circuit.cry(0.6, 0, 1)
diff --git a/test/python/qasm/all_gates.qasm b/test/python/qasm/all_gates.qasm
--- a/test/python/qasm/all_gates.qasm
+++ b/test/python/qasm/all_gates.qasm
@@ -13,6 +13,8 @@ id q[0];
 cx q[0], q[1];
 
 // the standard single qubit gates
+u(0.2, 0.1, 0.6) q[0];
+p(0.6) q[0];
 x q[0];
 y q[0];
 z q[0];
@@ -21,6 +23,8 @@ s q[0];
 t q[0];
 sdg q[0];
 tdg q[0];
+sx q[0];
+sxdg q[0];
 
 // the standard rotations
 rx(0.1) q[0];
@@ -37,8 +41,11 @@ cswap q[0], q[1], q[2];
 cy q[0], q[1];
 cz q[0], q[1];
 ch q[0], q[1];
+csx q[0], q[1];
 cu1(0.6) q[0], q[1];
 cu3(0.2,0.1,0.6) q[0], q[1];
+cp(0.6) q[0], q[1];
+cu(0.2,0.1,0.6,0) q[0], q[1];
 ccx q[0], q[1], q[2];
 
 crx(0.6) q[0], q[1];